Search Postgresql Archives

Re: Passing a PGconn * between two processes on Unix like systems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 22, 2010 at 08:35, Marc Balmer <marc@xxxxxxx> 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/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux