ev_prepare watcher awkwardness

Thilo Schulz thilo at tjps.eu
Wed Apr 22 17:27:41 CEST 2015


On Tuesday 21 April 2015 02:54:27 you wrote:
> > I'm a bit confounded by this paragreph. Yes, my use probably was not what
> > prepare watchers are designed for. But the last part of that sentence
> > rings false to me.
> Keep in mind that ev_prepare watchers are invoked in every event loop
> iteration. When you start it after the "before the poll call" moment
> passed, it would still be called before the next poll.

So basically, the sequence would be:

Queue ev_prepare watchers
  call prepare1
    prepare1 watcher adds prepare2 watcher
[...] (handle events)

next loop iteration

Queue ev_prepare watchers
  call prepare1
  call prepare2



> I guess it would, if libev had something like generic ev_watchers, but
> it hasn't (at least not officially). The struct ev_watcher you see is
> effectively the base class for watchers, it is not a watcher itself,
> although tricking the code to treat it like one would work in current
> versions, owing to the fact that a watcher really is just a few ints and a
> callback.

Hmm... understood.

Best regards,
Thilo Schulz

More information about the libev mailing list