Re: Inconsistent bgworker behaviour
От | Craig Ringer |
---|---|
Тема | Re: Inconsistent bgworker behaviour |
Дата | |
Msg-id | 54AD2F37.2050002@2ndquadrant.com обсуждение исходный текст |
Ответ на | Inconsistent bgworker behaviour (Beena Emerson <memissemerson@gmail.com>) |
Ответы |
Re: Inconsistent bgworker behaviour
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: