[zeromq-dev] czmq v3.0.0: zsys_handler_set - different semantics from v2 API
Pieter Hintjens
ph at imatix.com
Wed May 20 08:53:02 CEST 2015
Looks good to me. Thanks!
On Wed, May 20, 2015 at 8:00 AM, Michael Haberler <mail17 at mah.priv.at> wrote:
> in czmq v2.x, if you did a zsys_handler_set(NULL) at the beginning of the program, czmq would refrain from _any_ signal handling which is what I need (I do that synchronously with signalfd for those signals which can be trapped by signalfd)
>
> v3.0.0 outsmarts me by insisting on calling zsys_catch_interrupts() from zsys_init() if ZSYS_SIGHANDLER is not set, and that interferes with signalfd handling
>
> I guess the proper way would be to call zsys_catch_interrupts() ONLY if s_first_time is true
>
> if agreed, I'll prepare a PR
>
> - Michael
>
> @@ -160,12 +160,12 @@ zsys_init (void)
> else
> if (streq (getenv ("ZSYS_LOGSYSTEM"), "false"))
> s_logsystem = false;
> }
> // Catch SIGINT and SIGTERM unless ZSYS_SIGHANDLER=false
> - if ( getenv ("ZSYS_SIGHANDLER") == NULL
> - || strneq (getenv ("ZSYS_SIGHANDLER"), "false"))
> + if (( getenv ("ZSYS_SIGHANDLER") == NULL
> + || strneq (getenv ("ZSYS_SIGHANDLER"), "false")) && s_first_time)
> zsys_catch_interrupts ();
>
> ZMUTEX_INIT (s_mutex);
> s_sockref_list = zlist_new ();
> if (!s_sockref_list) {
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list