Skip to content

Commit f7aebd7

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 6dfc946 commit f7aebd7

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
@@ -1179,8 +1179,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
11791179

11801180
/*
11811181
* If we detected deadlock, give up without waiting. This must agree with
1182-
* CheckDeadLock's recovery code, except that we shouldn't release the
1183-
* semaphore since we haven't tried to lock it yet.
1182+
* CheckDeadLock's recovery code.
11841183
*/
11851184
if (early_deadlock)
11861185
{
@@ -1216,9 +1215,9 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
12161215

12171216
/*
12181217
* Set timer so we can wake up after awhile and check for a deadlock. If a
1219-
* deadlock is detected, the handler releases the process's semaphore and
1220-
* sets MyProc->waitStatus = STATUS_ERROR, allowing us to know that we
1221-
* must report failure rather than success.
1218+
* deadlock is detected, the handler sets MyProc->waitStatus =
1219+
* STATUS_ERROR, allowing us to know that we must report failure rather
1220+
* than success.
12221221
*
12231222
* By delaying the check until we've waited for a bit, we can avoid
12241223
* running the rather expensive deadlock-check code in most cases.
@@ -1561,7 +1560,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
15611560

15621561

15631562
/*
1564-
* ProcWakeup -- wake up a process by releasing its private semaphore.
1563+
* ProcWakeup -- wake up a process by setting its latch.
15651564
*
15661565
* Also remove the process from the wait queue and set its links invalid.
15671566
* RETURN: the next process in the wait queue.
@@ -1696,8 +1695,7 @@ CheckDeadLock(void)
16961695
* we know that we don't have to wait anymore.
16971696
*
16981697
* We check by looking to see if we've been unlinked from the wait queue.
1699-
* This is quicker than checking our semaphore's state, since no kernel
1700-
* call is needed, and it is safe because we hold the lock partition lock.
1698+
* This is safe because we hold the lock partition lock.
17011699
*/
17021700
if (MyProc->links.prev == NULL ||
17031701
MyProc->links.next == NULL)

0 commit comments

Comments
 (0)