Stopping a watcher in one callback where another may be called

Arlen Cuss celtic at sairyx.org
Wed Mar 30 06:30:31 CEST 2011


Hi all,

I'm using an ev_timer to timeout an operation where an ev_io may be
either listening for reads or writes. The ev_io watcher is allocated in
a struct which - if the ev_timer is triggered - gets deallocated. The
ev_io is of course stopped before its memory disappears.

My question now: say both the ev_timer and ev_io get triggered at the
same time. If the ev_timer callback gets called first, then the ev_io is
stopped and deallocated (as is all the auxiliary data that the ev_io
callback will be using, as it happens).

In this case, will the ev_io callback go ahead and get called? Or will
libev note that the ev_io watcher was stopped and no longer call it?

I've just realised that I can ensure this ordering of events will never
happen by using timeouts, but it'd be nice to know anyway!

Cheers,
Arlen





More information about the libev mailing list