[zeromq-dev] CZMQ zctx_new signal handler side effect
Philip Kovacs
kovacsp3 at comcast.net
Thu Dec 22 08:30:33 CET 2011
* Pieter Hintjens <ph at imatix.com> [2011-12-22 00:45:43 -0600]:
> On Wed, Dec 21, 2011 at 10:59 PM, Philip Kovacs <kovacsp3 at comcast.net> wrote:
>
> > If you run a reactor (zloop) in the main thread, I can see where the signal
> > handling is helpful, but consider the case where you run zloops in attached
> > threads. If the process gets a SIGTERM or SIGINT, the attached threads
> > shutdown cleanly, but the main thread ends up in an unexpected state.
> > You can have the main thread regain control of signal handling, of course,
> > by using sigaction after each zctx_new, but in that case, you are fighting
> > the czmq library.
>
> Hmm, it is true that shutting down a multithreaded app is delicate.
> You need to inform the parent thread via its pipe, and the parent
> needs to then exit explicitly. I don't think it would help to have
> signals caught by the parent; you would then get child threads not
> exiting properly.
Yeah, but then you create an obligation on the part of the main thread
to poll its side of the pipe also....
Phil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111222/372a764a/attachment.sig>
More information about the zeromq-dev
mailing list