From: Andres Freund Date: Thu, 1 Mar 2018 09:46:04 +0000 (-0800) Subject: doc: Add WaitForBackgroundWorkerShutdown() to bgw docs. X-Git-Tag: REL_11_BETA1~687 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a88609089ab84fc9f2a925bee31ec2e0c776d166;p=postgresql doc: Add WaitForBackgroundWorkerShutdown() to bgw docs. Commit 924bcf4f16d added WaitForBackgroundWorkerShutdown, but didn't add it to the documentation. Fix that and two small spelling errors in the WaitForBackgroundWorkerStartup paragraph. Author: Daniel Gustafsson Discussion: https://postgr.es/m/C8738949-0350-4999-A1DA-26E209FF248D@yesql.se --- diff --git a/doc/src/sgml/bgworker.sgml b/doc/src/sgml/bgworker.sgml index e490bb8750..18ad2e4577 100644 --- a/doc/src/sgml/bgworker.sgml +++ b/doc/src/sgml/bgworker.sgml @@ -259,13 +259,24 @@ typedef struct BackgroundWorker WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *) function. This function will block until the postmaster has attempted to start the - background worker, or until the postmaster dies. If the background runner - is running, the return value will BGWH_STARTED, and + background worker, or until the postmaster dies. If the background worker + is running, the return value will be BGWH_STARTED, and the PID will be written to the provided address. Otherwise, the return value will be BGWH_STOPPED or BGWH_POSTMASTER_DIED. + + A process can also wait for a background worker to shut down, by using the + WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle + *handle) function and passing the + BackgroundWorkerHandle * obtained at registration. This + function will block until the background worker exits, or postmaster dies. + When the background worker exits, the return value is + BGWH_STOPPED, if postmaster dies it will return + BGWH_POSTMASTER_DIED. + + If a background worker sends asynchronous notifications with the NOTIFY command via the Server Programming Interface