KnownAssignedXidsGetAndSetXmin(TransactionId *xarray, TransactionId *xmin,
TransactionId xmax)
{
- /* use volatile pointer to prevent code rearrangement */
- volatile ProcArrayStruct *pArray = procArray;
int count = 0;
int head,
tail;
*
* Must take spinlock to ensure we see up-to-date array contents.
*/
- SpinLockAcquire(&pArray->known_assigned_xids_lck);
- tail = pArray->tailKnownAssignedXids;
- head = pArray->headKnownAssignedXids;
- SpinLockRelease(&pArray->known_assigned_xids_lck);
+ SpinLockAcquire(&procArray->known_assigned_xids_lck);
+ tail = procArray->tailKnownAssignedXids;
+ head = procArray->headKnownAssignedXids;
+ SpinLockRelease(&procArray->known_assigned_xids_lck);
for (i = tail; i < head; i++)
{
static TransactionId
KnownAssignedXidsGetOldestXmin(void)
{
- /* use volatile pointer to prevent code rearrangement */
- volatile ProcArrayStruct *pArray = procArray;
int head,
tail;
int i;
/*
* Fetch head just once, since it may change while we loop.
*/
- SpinLockAcquire(&pArray->known_assigned_xids_lck);
- tail = pArray->tailKnownAssignedXids;
- head = pArray->headKnownAssignedXids;
- SpinLockRelease(&pArray->known_assigned_xids_lck);
+ SpinLockAcquire(&procArray->known_assigned_xids_lck);
+ tail = procArray->tailKnownAssignedXids;
+ head = procArray->headKnownAssignedXids;
+ SpinLockRelease(&procArray->known_assigned_xids_lck);
for (i = tail; i < head; i++)
{
void
InitProcess(void)
{
- /* use volatile pointer to prevent code rearrangement */
- volatile PROC_HDR *procglobal = ProcGlobal;
PGPROC * volatile * procgloballist;
/*
* ProcGlobal should be set up already (if we are a backend, we inherit
* this by fork() or EXEC_BACKEND mechanism from the postmaster).
*/
- if (procglobal == NULL)
+ if (ProcGlobal == NULL)
elog(PANIC, "proc header uninitialized");
if (MyProc != NULL)
/* Decide which list should supply our PGPROC. */
if (IsAnyAutoVacuumProcess())
- procgloballist = &procglobal->autovacFreeProcs;
+ procgloballist = &ProcGlobal->autovacFreeProcs;
else if (IsBackgroundWorker)
- procgloballist = &procglobal->bgworkerFreeProcs;
+ procgloballist = &ProcGlobal->bgworkerFreeProcs;
else
- procgloballist = &procglobal->freeProcs;
+ procgloballist = &ProcGlobal->freeProcs;
/*
* Try to get a proc struct from the appropriate free list. If this
*/
SpinLockAcquire(ProcStructLock);
- set_spins_per_delay(procglobal->spins_per_delay);
+ set_spins_per_delay(ProcGlobal->spins_per_delay);
MyProc = *procgloballist;
void
PublishStartupProcessInformation(void)
{
- /* use volatile pointer to prevent code rearrangement */
- volatile PROC_HDR *procglobal = ProcGlobal;
-
SpinLockAcquire(ProcStructLock);
- procglobal->startupProc = MyProc;
- procglobal->startupProcPid = MyProcPid;
+ ProcGlobal->startupProc = MyProc;
+ ProcGlobal->startupProcPid = MyProcPid;
SpinLockRelease(ProcStructLock);
}
{
PGPROC *proc;
- /* use volatile pointer to prevent code rearrangement */
- volatile PROC_HDR *procglobal = ProcGlobal;
-
SpinLockAcquire(ProcStructLock);
- proc = procglobal->freeProcs;
+ proc = ProcGlobal->freeProcs;
while (n > 0 && proc != NULL)
{
static void
ProcKill(int code, Datum arg)
{
- /* use volatile pointer to prevent code rearrangement */
- volatile PROC_HDR *procglobal = ProcGlobal;
PGPROC *proc;
PGPROC * volatile * procgloballist;
*procgloballist = proc;
/* Update shared estimate of spins_per_delay */
- procglobal->spins_per_delay = update_spins_per_delay(procglobal->spins_per_delay);
+ ProcGlobal->spins_per_delay = update_spins_per_delay(ProcGlobal->spins_per_delay);
SpinLockRelease(ProcStructLock);
if (RecoveryInProgress())
{
- /* use volatile pointer to prevent code rearrangement */
- volatile PROC_HDR *procglobal = ProcGlobal;
-
SpinLockAcquire(ProcStructLock);
/*
* backend, so BackendPidGetProc() will not return any pid at all. So
* we remember the information for this special case.
*/
- if (pid == procglobal->startupProcPid)
- proc = procglobal->startupProc;
+ if (pid == ProcGlobal->startupProcPid)
+ proc = ProcGlobal->startupProc;
SpinLockRelease(ProcStructLock);
}