mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Make critical sections (elog->crash) and interrupt holdoff sections
into distinct concepts, per recent discussion on pghackers.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.60 2001/01/14 05:08:15 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.61 2001/01/19 22:08:46 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@@ -136,7 +136,8 @@ proc_exit(int code)
|
||||
QueryCancelPending = false;
|
||||
/* And let's just make *sure* we're not interrupted ... */
|
||||
ImmediateInterruptOK = false;
|
||||
CritSectionCount = 1;
|
||||
InterruptHoldoffCount = 1;
|
||||
CritSectionCount = 0;
|
||||
|
||||
if (DebugLvl > 1)
|
||||
elog(DEBUG, "proc_exit(%d)", code);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.29 2001/01/14 05:08:15 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/spin.c,v 1.30 2001/01/19 22:08:47 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -148,19 +148,19 @@ SpinAcquire(SPINLOCK lockid)
|
||||
PRINT_SLDEBUG("SpinAcquire", lockid, slckP);
|
||||
/*
|
||||
* Acquire the lock, then record that we have done so (for recovery
|
||||
* in case of elog(ERROR) during the critical section). Note we assume
|
||||
* in case of elog(ERROR) while holding the lock). Note we assume
|
||||
* here that S_LOCK will not accept cancel/die interrupts once it has
|
||||
* acquired the lock. However, interrupts should be accepted while
|
||||
* waiting, if CritSectionCount is zero.
|
||||
* waiting, if InterruptHoldoffCount is zero.
|
||||
*/
|
||||
S_LOCK(&(slckP->shlock));
|
||||
PROC_INCR_SLOCK(lockid);
|
||||
/*
|
||||
* Lock out cancel/die interrupts until we exit the critical section
|
||||
* Lock out cancel/die interrupts until we exit the code section
|
||||
* protected by the spinlock. This ensures that interrupts will not
|
||||
* interfere with manipulations of data structures in shared memory.
|
||||
*/
|
||||
START_CRIT_SECTION();
|
||||
HOLD_INTERRUPTS();
|
||||
|
||||
PRINT_SLDEBUG("SpinAcquire/done", lockid, slckP);
|
||||
}
|
||||
@@ -182,9 +182,9 @@ SpinRelease(SPINLOCK lockid)
|
||||
PROC_DECR_SLOCK(lockid);
|
||||
S_UNLOCK(&(slckP->shlock));
|
||||
/*
|
||||
* Exit the critical section entered in SpinAcquire().
|
||||
* Exit the interrupt holdoff entered in SpinAcquire().
|
||||
*/
|
||||
END_CRIT_SECTION();
|
||||
RESUME_INTERRUPTS();
|
||||
|
||||
PRINT_SLDEBUG("SpinRelease/done", lockid, slckP);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ SpinAcquire(SPINLOCK lock)
|
||||
*/
|
||||
IpcSemaphoreLock(SpinLockIds[0], lock, false);
|
||||
PROC_INCR_SLOCK(lock);
|
||||
START_CRIT_SECTION();
|
||||
HOLD_INTERRUPTS();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -351,7 +351,7 @@ SpinRelease(SPINLOCK lock)
|
||||
Assert(!MyProc || MyProc->sLocks[lockid] > 0);
|
||||
PROC_DECR_SLOCK(lock);
|
||||
IpcSemaphoreUnlock(SpinLockIds[0], lock);
|
||||
END_CRIT_SECTION();
|
||||
RESUME_INTERRUPTS();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user