Pre-fork and post-fork callback infrastructure ...
Volker Lendecke
Volker.Lendecke at SerNet.DE
Thu May 7 07:30:39 MDT 2015
On Wed, May 06, 2015 at 03:10:46PM -0700, Richard Sharpe wrote:
> Hi folks,
>
> I encountered a problem with the Zookeeper work I did a while ago
> because the Zookeeper client library is not fork safe. I had to hack a
> bunch of code in to reinit the connection to the Zookeeper server in
> each child.
>
> I notice that we already have reinit_after_fork and wondered whether
> we should have some standard infrastructure for where things need to
> be reinitialized after a fork.
>
> The sort of thing I am thinking of is some registration routines that
> allows a subsystem to register:
>
> 1. A pre-fork callback. This would be called in the parent just before
> the fork and passed an opaque pointer to a private data structure.
>
> 2. A post-fork callback that would be called in the parent and the
> child and passed the response from fork and an opaque pointer.
man pthread_atfork
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list