Skip to content

Commit df098c3

Browse files
committed
Remove obsolete comments about sempahores from proc.c.
Commit 6753333 switched from a semaphore-based wait to a latch-based wait for ProcSleep()/ProcWakeup(), but left behind some stray references to semaphores. Back-patch to 9.5. Reviewed-by: Daniel Gustafsson, Michael Paquier Discussion: https://postgr.es/m/CA+hUKGLs5H6zhmgTijZ1OaJvC1sG0=AFXc1aHuce32tKiQrdEA@mail.gmail.com
1 parent 0772d8a commit df098c3

File tree

1 file changed

+6
-8
lines changed
  • src/backend/storage/lmgr

1 file changed

+6
-8
lines changed

src/backend/storage/lmgr/proc.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
11671167

11681168
/*
11691169
* If we detected deadlock, give up without waiting. This must agree with
1170-
* CheckDeadLock's recovery code, except that we shouldn't release the
1171-
* semaphore since we haven't tried to lock it yet.
1170+
* CheckDeadLock's recovery code.
11721171
*/
11731172
if (early_deadlock)
11741173
{
@@ -1204,9 +1203,9 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
12041203

12051204
/*
12061205
* Set timer so we can wake up after awhile and check for a deadlock. If a
1207-
* deadlock is detected, the handler releases the process's semaphore and
1208-
* sets MyProc->waitStatus = STATUS_ERROR, allowing us to know that we
1209-
* must report failure rather than success.
1206+
* deadlock is detected, the handler sets MyProc->waitStatus =
1207+
* STATUS_ERROR, allowing us to know that we must report failure rather
1208+
* than success.
12101209
*
12111210
* By delaying the check until we've waited for a bit, we can avoid
12121211
* running the rather expensive deadlock-check code in most cases.
@@ -1549,7 +1548,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
15491548

15501549

15511550
/*
1552-
* ProcWakeup -- wake up a process by releasing its private semaphore.
1551+
* ProcWakeup -- wake up a process by setting its latch.
15531552
*
15541553
* Also remove the process from the wait queue and set its links invalid.
15551554
* RETURN: the next process in the wait queue.
@@ -1684,8 +1683,7 @@ CheckDeadLock(void)
16841683
* we know that we don't have to wait anymore.
16851684
*
16861685
* We check by looking to see if we've been unlinked from the wait queue.
1687-
* This is quicker than checking our semaphore's state, since no kernel
1688-
* call is needed, and it is safe because we hold the lock partition lock.
1686+
* This is safe because we hold the lock partition lock.
16891687
*/
16901688
if (MyProc->links.prev == NULL ||
16911689
MyProc->links.next == NULL)

0 commit comments

Comments
 (0)