mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Remove superfluous 'pgprocno' field from PGPROC
It was always just the index of the PGPROC entry from the beginning of the proc array. Introduce a macro to compute it from the pointer instead. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi
This commit is contained in:
@@ -57,7 +57,7 @@ ConditionVariableInit(ConditionVariable *cv)
|
||||
void
|
||||
ConditionVariablePrepareToSleep(ConditionVariable *cv)
|
||||
{
|
||||
int pgprocno = MyProc->pgprocno;
|
||||
int pgprocno = MyProcNumber;
|
||||
|
||||
/*
|
||||
* If some other sleep is already prepared, cancel it; this is necessary
|
||||
@@ -181,10 +181,10 @@ ConditionVariableTimedSleep(ConditionVariable *cv, long timeout,
|
||||
* guarantee not to return spuriously, we'll avoid this obvious case.
|
||||
*/
|
||||
SpinLockAcquire(&cv->mutex);
|
||||
if (!proclist_contains(&cv->wakeup, MyProc->pgprocno, cvWaitLink))
|
||||
if (!proclist_contains(&cv->wakeup, MyProcNumber, cvWaitLink))
|
||||
{
|
||||
done = true;
|
||||
proclist_push_tail(&cv->wakeup, MyProc->pgprocno, cvWaitLink);
|
||||
proclist_push_tail(&cv->wakeup, MyProcNumber, cvWaitLink);
|
||||
}
|
||||
SpinLockRelease(&cv->mutex);
|
||||
|
||||
@@ -236,8 +236,8 @@ ConditionVariableCancelSleep(void)
|
||||
return false;
|
||||
|
||||
SpinLockAcquire(&cv->mutex);
|
||||
if (proclist_contains(&cv->wakeup, MyProc->pgprocno, cvWaitLink))
|
||||
proclist_delete(&cv->wakeup, MyProc->pgprocno, cvWaitLink);
|
||||
if (proclist_contains(&cv->wakeup, MyProcNumber, cvWaitLink))
|
||||
proclist_delete(&cv->wakeup, MyProcNumber, cvWaitLink);
|
||||
else
|
||||
signaled = true;
|
||||
SpinLockRelease(&cv->mutex);
|
||||
@@ -281,7 +281,7 @@ ConditionVariableSignal(ConditionVariable *cv)
|
||||
void
|
||||
ConditionVariableBroadcast(ConditionVariable *cv)
|
||||
{
|
||||
int pgprocno = MyProc->pgprocno;
|
||||
int pgprocno = MyProcNumber;
|
||||
PGPROC *proc = NULL;
|
||||
bool have_sentinel = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user