Re: dynamic background workers, round two - Mailing list pgsql-hackers

From Robert Haas
Subject Re: dynamic background workers, round two
Date
Msg-id CA+TgmoakmgbuZ_omgsHrHHvxxJTcr1Sq9kmGL0v5WR+vvg2aDA@mail.gmail.com
Whole thread Raw
In response to Re: dynamic background workers, round two  (Andres Freund <andres@anarazel.de>)
Responses Re: dynamic background workers, round two  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
On Sun, Aug 11, 2013 at 1:31 AM, Andres Freund <andres@anarazel.de> wrote:
> So, I'd suggest something like:
>
> typedef enum BgwHandleStatus {
>    BGWH_SUCCESS, /* sucessfully got status */
>    BGWH_NOT_YET, /* worker hasn't started yet */
>    BGWH_GONE, /* worker had been started, but shut down already */
>    BGWH_POSTMASTER_DIED /* well, there you go */
> } BgwHandleStatus;
>
>
> BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle, pid_t *pid);
> BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pid);

OK, here's a patch that API.  I renamed the constants a bit, because a
process that has stopped is not necessarily gone; it could be
configured for restart.  But we can say that it is stopped, at the
moment.

I'm not sure that this API is an improvement.  But I think it's OK, if
you prefer it.

...Robert

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: StrategyGetBuffer optimization, take 2
Next
From: Andrew Dunstan
Date:
Subject: Re: Fix Windows socket error checking for MinGW