On Thu, Jul 22, 2010 at 08:35, Marc Balmer <marc@msys.ch> wrote:
> I two Unix/ process related questions:
>
> Is there a documented way to pass around an (opened) PGconn * structure
> between two processes on Unix?
No.
You can probably hack up something yourself but you'd have to look
inside the struct which is not part of the public API - so it'd be a
very version-dependent (even minor-version dependent!) hack.
> When a process forks() and both the parent and child process continue to
> use a previously opened PGconn * structure, is that behaviour defined?
Yes - "broken" :-)
Well, the child can continue to use it *as long as the parent doesn't
use it anymore*.
And note that while it may be a good idea in general to close the
socket in the parent, you can *not* call PQclose() on it - that'll
tell the server you're disconnecting, and the child will stop working.
In theory you could do something like close(PQsocket(conn))...
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/