[zeromq-dev] problem with czmq zloop timer

Pieter Hintjens ph at imatix.com
Tue Sep 10 13:47:30 CEST 2013

On Tue, Sep 10, 2013 at 1:36 PM, Chris Laws <clawsicus at gmail.com> wrote:

> My application is encapsulated within a struct that contains state, sockets,
> etc which I think is a typical approach.

Right. If you use the same reference for multiple timers, they're all
going to be cancelled at the same time. The logic is that when you
destroy an object (your app), you want to destroy all timers
associated with it too. So this is how the API works.

If you have multiple timers that you are continually creating and
cancelling, you might first see if that's the right design at all. The
'normal' pattern is to set-up repeating timers, and leave them, or use
one-shot timers that self-cancel.

If you really need to create and cancel arbitrary timers, you'll have
to add a small layer to manage them. Create timer_t objects, each
referencing your application, and pass the timer_t objects to zloop.


More information about the zeromq-dev mailing list