diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-09-15 10:06:21 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-09-15 10:06:21 +0000 |
commit | 236b6bc29e532822a366b56404ecaf1d906229bf (patch) | |
tree | 451f5001ad5179bf8ff566e467b30b9cfa005962 /src/backend/port/unix_latch.c | |
parent | 1eab7a560d09fcd7314acd46ded955a37a262683 (diff) | |
download | postgresql-236b6bc29e532822a366b56404ecaf1d906229bf.tar.gz postgresql-236b6bc29e532822a366b56404ecaf1d906229bf.zip |
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.
Diffstat (limited to 'src/backend/port/unix_latch.c')
-rw-r--r-- | src/backend/port/unix_latch.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/src/backend/port/unix_latch.c b/src/backend/port/unix_latch.c index e1cb6f219e9..d5d61432893 100644 --- a/src/backend/port/unix_latch.c +++ b/src/backend/port/unix_latch.c @@ -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) @@ -323,29 +325,6 @@ ResetLatch(volatile Latch *latch) } /* - * 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. */ |