]> granicus.if.org Git - postgresql/commit
Provide a reliable mechanism for terminating a background worker.
authorRobert Haas <rhaas@postgresql.org>
Fri, 18 Oct 2013 14:21:25 +0000 (10:21 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 18 Oct 2013 14:23:11 +0000 (10:23 -0400)
commit523beaa11bdf6a9864e8978b467ed586b792c9ca
tree69243f9df4616e5d79cee9e48dc9943fa495df16
parentc2316dcda1cd057d7d4a56e3a51e3f8f0527e906
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.
doc/src/sgml/bgworker.sgml
src/backend/postmaster/bgworker.c
src/backend/postmaster/postmaster.c
src/include/postmaster/bgworker.h
src/include/postmaster/bgworker_internals.h