pgsql: Provide a reliable mechanism for terminating a background worker

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Provide a reliable mechanism for terminating a background worker
Date: 2013-10-18 14:26:29
Message-ID: E1VXB0X-0005aQ-7X@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/523beaa11bdf6a9864e8978b467ed586b792c9ca

Modified Files
--------------
doc/src/sgml/bgworker.sgml | 19 +++++---
src/backend/postmaster/bgworker.c | 65 ++++++++++++++++++++++++---
src/backend/postmaster/postmaster.c | 10 ++++-
src/include/postmaster/bgworker.h | 20 ++++++---
src/include/postmaster/bgworker_internals.h | 1 +
5 files changed, 96 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2013-10-18 14:42:37 pgsql: Allow only some columns of a view to be auto-updateable.
Previous Message Peter Eisentraut 2013-10-18 13:56:14 pgsql: Fix for lack of va_copy() on certain Windows versions