[zeromq-dev] czmq_new() and automatically installed signal handlers

Pieter Hintjens ph at imatix.com
Wed Jan 2 20:54:09 CET 2013

Good question...

You're going to run into trouble if you want to exit any 0MQ loop, if
your application is catching the signals, unless you emulate something
like zctx_interrupted.

Assuming you have an answer for that, I'd suggest a simple change; if
zctx_interrupted is non-zero, don't install a signal handler.

I've made a patch that does this:

Waiting for someone to merge to master along with other changes at


On Mon, Dec 31, 2012 at 5:52 PM, Andy Ballingall TF
<ballingall at thefoundry.co.uk> wrote:
> If you call zctx_new(), then it automatically adds a signal handler which
> captures SIGINT and SIGTERM. (At least for *nix)
> I'm using czmq to add new functionality to existing applications, some of
> which already have signal handling in place, so that's going to be an issue.
> Has anyone discussed making the signal handling addition an option when
> calling zctx_new()?
> (This is the only discussion I could find and it isn't quite what I'm after)
> http://grokbase.com/t/zeromq/zeromq-dev/11cpsq2ccg/czmq-zctx-new-signal-handler-side-effect
> Andy
> --
> Andy Ballingall
> Senior Software Engineer
> The Foundry
> 6th Floor, The Communications Building,
> 48, Leicester Square,
> London, WC2H 7LT, UK
> Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
> Web: http://www.thefoundry.co.uk/
> The Foundry Visionmongers Ltd.
> Registered in England and Wales No: 4642027
> _______________________________________________
> 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