[zeromq-dev] cancel czmq timers by id

Chris Laws clawsicus at gmail.com
Wed Nov 20 09:58:47 CET 2013


Many of my system's (CZMQ based) applications are long running, though some
applications within my system come and go. Many applications do various
timer based work when certain applications are present and should not be
doing these timer actions when certain applications are not present.
Consequently, I have a need to be able to cancel certain timers (but not
all timers) throughout the lifetime of my applications without stopping all
of the application timers.

The current zloop timer implementation makes this difficult for me because
it cancels all timers that match the 'arg'. Typically the 'arg' is the
application context structure containing useful references to application
data and state. In my case it is always the 'arg' and I would think that
this is pretty standard usage too.

I've submitted pull request #318 (https://github.com/zeromq/czmq/pull/318)
to create a conversation topic regarding the changes contained within,
which change the behaviour such that timers can be cancelled using their
timer_id. I've been using this code successfully for some time now and the
czmq_selftest indicates that there are no leaks. Ideally I'd like this
functionality present in czmq, pending no significant issues, objections or
show stoppers. As Pieter points out, this constitutes an API change.

This implementation fits well with the event-reactor style applications I
create that typically finalise and terminate upon exit of the event loop.
Perhaps this implementation might not fit so well with other styles?

Thoughts? Would this type of change help or hinder you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20131120/1858ed70/attachment.html>


More information about the zeromq-dev mailing list