On 01/07/2015 11:54 AM, Beena Emerson wrote: > > ResetLatch(&MyProc->procLatch); > TerminateBackgroundWorker(workers[i]->handle); > WaitLatch(&MyProc->procLatch, WL_LATCH_SET, 0); This doesn't guarantee that the worker of interest has terminated, just that your latch got set. You should make sure the worker of interest is actually dead, and you didn't get a SIGUSR1 for some other reason. We could probably use a WaitForBackgroundWorkerTermination(...) to correspond to WaitForBackgroundWorkerStartup(...) . I think you'll probably want to GetBackgroundWorkerPid(...) and examine the returned BgwHandleStatus to see if it's BGWH_STOPPED . If not, keep waiting. You might want a timeout to re-check. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general