[zeromq-dev] Seek clarification on return value from ticket handlers (zloop)
Steven Butner
butner.se at gmail.com
Fri Apr 17 19:13:12 CEST 2015
This is an inquiry about the interface with ticket handlers and zloop.
I am running what I believe to be the latest development master of czmq
(downloaded Wed 2015/4/15 from github). My host is Ubuntu Linux 14.04LTS
running on a 64-bit Intel Core-i7.
Prior to this I had been running the 3.0.0-rc1 version of CZMQ (dated
2014/10/15) that is offered on
http://czmq.zeromq.org/page:get-the-software. I switched to the more
recent version because there were some missing features appearing in the
CZMQ manual pages but absent from 3.0.0-rc1 package, notably anything
having to do with tickets.
My question has to do with the semantics of the return int value on
ticket timer handlers
*typedef int (zloop_time_fn) (zloop_t *loop, int timer_id, void *arg);*
The synopsis is silent about the meaning of this int, though the
synopsis comments about zloop_start() suggest that any handler that
returns -1 will cause the reactor to break out of its loop.
My experimentation (augmented by a look into the source code) shows that
the return code from ticket handlers takes a different path when -1 is
returned than when 0 is returned ..... but that the return of a -1 does
*not* make the zloop_start reactor break out of its loop. I've also
been having trouble interrupting the system. My program seems to ignore
interrupts, even though I can verify via gdb that the signals are
getting delivered to my process.
My specific questions are:
1) What is the semantics of the return code emerging from ticket handlers?
2) When a ticket times out and the ticket handler is called, what should
be the behavior of that ticket in the future? In my ticket handler I am
calling zloop_ticket_reset(zloop, ticket_handle) with the hope that the
ticket expiry will be noted but activated again for catching future
issues with the given service. I've observed that if the ticket handler
returns a 0, we never get any more calls to it whereas if the ticket
handler returns a -1, we do get future calls.
3) Why is the second argument in the ticket handler interface using an
int timer_id when the ticket interface elsewhere seems to be using void*
handles?
4) Why do get different behavior with regard to Ctlr-C interruptions
when my ticket handlers return -1 than when they return 0?
Thanks for any clarification on this interface. I'm happy to supply
snippets of my usage code once I know what is needed. Though I am a
long-time programmer, I am relatively new to ZMQ and CZMQ. I thank you
all for contributing and supporting this excellent software.
Steve B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150417/851eb081/attachment.htm>
More information about the zeromq-dev
mailing list