[zeromq-dev] czmq v3.0.0: zsys_handler_set - different semantics from v2 API

Michael Haberler mail17 at mah.priv.at
Wed May 20 08:00:29 CEST 2015


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) {


More information about the zeromq-dev mailing list