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

Andy Ballingall TF ballingall at thefoundry.co.uk
Thu Jan 3 12:44:08 CET 2013


>
> 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.
>

In this scenario, I was envisaging that the application would be obliged to
state whether it handled the signals in question, and if so, would
additionally be obliged to call a function in my library which would set
zctx_interrupted to 1.


>
> 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.
>
> Yes, that's perfect. So I'll just temporarily set zctx_interrupted to 1
prior to calling zctx_new() and reset it to 0 immediately afterwards so
that my reactor will run normally.

Many thanks,
Andy


> I've made a patch that does this:
>
> https://github.com/hintjens/czmq/commit/4491c46f2063442eafcaffcebaa31e54dc2ecdf4
>
> Waiting for someone to merge to master along with other changes at
> https://github.com/zeromq/czmq/pull/106.
>
> -Pieter
>
> 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
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130103/18a02557/attachment.htm>


More information about the zeromq-dev mailing list