mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Simplify Windows implementation of latches. There's no need to keep a
dynamic pool of event handles, we can permanently assign one for each shared latch. Thanks to that, we no longer need a separate shared memory block for latches, and we don't need to know in advance how many shared latches there is, so you no longer need to remember to update NumSharedLatches when you introduce a new latch to the system.
This commit is contained in:
@ -77,7 +77,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/unix_latch.c,v 1.3 2010/09/13 18:01:20 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/unix_latch.c,v 1.4 2010/09/15 10:06:21 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -129,8 +129,10 @@ InitLatch(volatile Latch *latch)
|
||||
* is initially owned by no-one, use OwnLatch to associate it with the
|
||||
* current process.
|
||||
*
|
||||
* NB: When you introduce a new shared latch, you must increase the shared
|
||||
* latch count in NumSharedLatches in win32_latch.c!
|
||||
* InitSharedLatch needs to be called in postmaster before forking child
|
||||
* processes, usually right after allocating the shared memory block
|
||||
* containing the latch with ShmemInitStruct. The Unix implementation
|
||||
* doesn't actually require that, but the Windows one does.
|
||||
*/
|
||||
void
|
||||
InitSharedLatch(volatile Latch *latch)
|
||||
@ -322,29 +324,6 @@ ResetLatch(volatile Latch *latch)
|
||||
latch->is_set = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* LatchShmemSize
|
||||
* Compute space needed for latch's shared memory
|
||||
*
|
||||
* Not needed for Unix implementation.
|
||||
*/
|
||||
Size
|
||||
LatchShmemSize(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* LatchShmemInit
|
||||
* Allocate and initialize shared memory needed for latches
|
||||
*
|
||||
* Not needed for Unix implementation.
|
||||
*/
|
||||
void
|
||||
LatchShmemInit(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* SetLatch uses SIGUSR1 to wake up the process waiting on the latch. Wake
|
||||
* up WaitLatch.
|
||||
|
Reference in New Issue
Block a user