[zeromq-dev] problem with czmq zloop timer

Chris Laws clawsicus at gmail.com
Tue Sep 10 13:36:24 CEST 2013


Hi list,

I am developing applications using the czmq zmq binding. My application
uses multiple timers to perform various time dependant actions. I am
encountering issues when cancelling timers.

My application is encapsulated within a struct that contains state,
sockets, etc which I think is a typical approach. Indeed, this approach
seems common within the czmq implementation. I pass this struct into the
timer callbacks as the arg parameter so that the timer functions can access
some various application state information and sockets while performing
their actions.

An unfortunate consequence of this usage pattern is that multiple timers
share the same arg and due to the internal czmq implementation, when I
cancel one timer it results in all timers with a matching arg getting
cancelled. This is not what I want to happen. I only want a specific timer
to end.

Am I missing something? Is there a common design pattern that should be
used with timers that avoids this problem?

If there is no particular design pattern that is recommended I think I have
a modification that could avoid this problem... if indeed it is considered
to be a problem.


Regards,

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130910/c69a9e53/attachment.htm>


More information about the zeromq-dev mailing list