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

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: Passing a PGconn * between two processes on Unix like systems
Дата
Msg-id AANLkTim7OkpxBAG-1J6kdd1QdI-ci7T8RvqLa_vGYpe3@mail.gmail.com
обсуждение исходный текст
Ответ на Passing a PGconn * between two processes on Unix like systems  (Marc Balmer <marc@msys.ch>)
Список pgsql-general
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/

В списке pgsql-general по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Finding last checkpoint time
Следующее
От: Oliver Kohll - Mailing Lists
Дата:
Сообщение: Re: locating cities within a radius of another