zeromq/czmq — pull request #318 by claws (2013-11-19 12:28:59+00:00)
Title: cancel timers by identifier

Many of my systems 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. In my case it is always the 'arg'.

I've submitted this pull request 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.

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?