summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/procsignal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/ipc/procsignal.c')
-rw-r--r--src/backend/storage/ipc/procsignal.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
index a6f77c105c2..c4b5d0196b3 100644
--- a/src/backend/storage/ipc/procsignal.c
+++ b/src/backend/storage/ipc/procsignal.c
@@ -21,6 +21,7 @@
#include "miscadmin.h"
#include "storage/latch.h"
#include "storage/ipc.h"
+#include "storage/proc.h"
#include "storage/shmem.h"
#include "storage/sinval.h"
#include "tcop/tcopprot.h"
@@ -57,6 +58,14 @@ typedef struct
*/
#define NumProcSignalSlots (MaxBackends + NUM_AUXPROCTYPES)
+/*
+ * If this flag is set, the process latch will be set whenever SIGUSR1
+ * is received. This is useful when waiting for a signal from the postmaster.
+ * Spurious wakeups must be expected. Make sure that the flag is cleared
+ * in the error path.
+ */
+bool set_latch_on_sigusr1;
+
static ProcSignalSlot *ProcSignalSlots = NULL;
static volatile ProcSignalSlot *MyProcSignalSlot = NULL;
@@ -276,6 +285,9 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
+ if (set_latch_on_sigusr1)
+ SetLatch(&MyProc->procLatch);
+
latch_sigusr1_handler();
errno = save_errno;