Using EV_CUSTOM for custom events

Konstantin Osipov kostja at
Sat Apr 28 20:59:53 CEST 2012

* Zsbán Ambrus <ambrus at> [12/04/28 00:46]:
> > OK, a timer with zero timeout looks safer than a watcher on a
> > signal, since in the latter case there could be spurious wake-ups.
> There wouldn't be, because you never actually _start_ the signal
> watcher, so it never watches for anything.  You just make it pending
> with the ev_feed_event function, which makes the loop run its callback
> next time.  What kind of watcher it is doesn't really matter if the
> watcher is not active.
> Note that if you make a watcher pending this way, then the event loop
> will reference it, so you can't free its memory until you call
> ev_signal_stop which clears its pending state.

This makes it a lot more clear. Thank you very much!
And reading the code is always easier with such guidance.

-- - an efficient, extensible in-memory data store

More information about the libev mailing list