diff options
| author | Andres Freund <andres@anarazel.de> | 2015-01-14 18:45:22 +0100 |
|---|---|---|
| committer | Andres Freund <andres@anarazel.de> | 2015-01-14 18:45:22 +0100 |
| commit | 59f71a0d0b56b2df48db4bf1738aece5551f7a47 (patch) | |
| tree | 6023eb572eade66adb21ee0ae84fd6aa33e30ac9 /src/test/modules/test_shm_mq/setup.c | |
| parent | 85a2a8903f7e9151793308d0638621003aded5ae (diff) | |
| download | postgresql-59f71a0d0b56b2df48db4bf1738aece5551f7a47.tar.gz | |
Add a default local latch for use in signal handlers.
To do so, move InitializeLatchSupport() into the new common process
initialization functions, and add a new global variable MyLatch.
MyLatch is usable as soon InitPostmasterChild() has been called
(i.e. very early during startup). Initially it points to a process
local latch that exists in all processes. InitProcess/InitAuxiliaryProcess
then replaces that local latch with PGPROC->procLatch. During shutdown
the reverse happens.
This is primarily advantageous for two reasons: For one it simplifies
dealing with the shared process latch, especially in signal handlers,
because instead of having to check for MyProc, MyLatch can be used
unconditionally. For another, a later patch that makes FEs/BE
communication use latches, now can rely on the existence of a latch,
even before having gone through InitProcess.
Discussion: 20140927191243.GD5423@alap3.anarazel.de
Diffstat (limited to 'src/test/modules/test_shm_mq/setup.c')
| -rw-r--r-- | src/test/modules/test_shm_mq/setup.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c index b049cff2d0..195099095d 100644 --- a/src/test/modules/test_shm_mq/setup.c +++ b/src/test/modules/test_shm_mq/setup.c @@ -285,13 +285,13 @@ wait_for_workers_to_become_ready(worker_state *wstate, } /* Wait to be signalled. */ - WaitLatch(&MyProc->procLatch, WL_LATCH_SET, 0); + WaitLatch(MyLatch, WL_LATCH_SET, 0); /* An interrupt may have occurred while we were waiting. */ CHECK_FOR_INTERRUPTS(); /* Reset the latch so we don't spin. */ - ResetLatch(&MyProc->procLatch); + ResetLatch(MyLatch); } } PG_CATCH(); |
