Skip to content

Commit 75ec47c

Browse files
committed
Add comment to explain why PGReserveSemaphores() is called early
Before commit e256266, PGReserveSemaphores() had to be called before SpinlockSemaInit() because spinlocks were implemented using semaphores on some platforms (--disable-spinlocks). Add a comment explaining that. Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/CAExHW5seSZpPx-znjidVZNzdagGHOk06F+Ds88MpPUbxd1kTaA@mail.gmail.com Backpatch-to: 18
1 parent 8312253 commit 75ec47c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/storage/ipc/ipci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ CreateSharedMemoryAndSemaphores(void)
225225
InitShmemAccess(seghdr);
226226

227227
/*
228-
* Create semaphores
228+
* Create semaphores. (This is done here for historical reasons. We used
229+
* to support emulating spinlocks with semaphores, which required
230+
* initializing semaphores early.)
229231
*/
230232
PGReserveSemaphores(numSemas);
231233

0 commit comments

Comments
 (0)