summaryrefslogtreecommitdiff
path: root/src/include/postmaster/bgworker_internals.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2013-10-18 10:21:25 -0400
committerRobert Haas <rhaas@postgresql.org>2013-10-18 10:23:11 -0400
commit523beaa11bdf6a9864e8978b467ed586b792c9ca (patch)
tree69243f9df4616e5d79cee9e48dc9943fa495df16 /src/include/postmaster/bgworker_internals.h
parentc2316dcda1cd057d7d4a56e3a51e3f8f0527e906 (diff)
downloadpostgresql-523beaa11bdf6a9864e8978b467ed586b792c9ca.tar.gz
Provide a reliable mechanism for terminating a background worker.
Although previously-introduced APIs allow the process that registers a background worker to obtain the worker's PID, there's no way to prevent a worker that is not currently running from being restarted. This patch introduces a new API TerminateBackgroundWorker() that prevents the background worker from being restarted, terminates it if it is currently running, and causes it to be unregistered if or when it is not running. Patch by me. Review by Michael Paquier and KaiGai Kohei.
Diffstat (limited to 'src/include/postmaster/bgworker_internals.h')
-rw-r--r--src/include/postmaster/bgworker_internals.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h
index 6d5ee20dc3..e7e1ab94ad 100644
--- a/src/include/postmaster/bgworker_internals.h
+++ b/src/include/postmaster/bgworker_internals.h
@@ -31,6 +31,7 @@ typedef struct RegisteredBgWorker
int rw_child_slot;
TimestampTz rw_crashed_at; /* if not 0, time it last crashed */
int rw_shmem_slot;
+ bool rw_terminate;
slist_node rw_lnode; /* list link */
} RegisteredBgWorker;