Suggestion for new watcher type: called immediately after execution of current watcher has finished

Marc Lehmann schmorp at
Sat Apr 18 08:56:33 CEST 2015

On Fri, Apr 17, 2015 at 07:48:15PM +0200, Thilo Schulz <thilo at> wrote:
> What I was missing for this case was a way to make libev execute something
> immediately after the current watcher is done, even before other pending
> watchers are executed.

And why would the be necessary? If ev_prepare is soon enough, then you
obviously don't have the requirement of doing it immediately.

> Instead, I used a prepare watcher, which is close enough for me. (In my
> case it doesn't really matter if pending watchers are executed first).
> The prepare watcher has its own traps, as I laid out in my prior email.

Well, foremost, it doesn't solve your stated problem at all.

If you just want a delayed unload, you can use ev_idle, or ev_timer. This
sounds like the likely fix to your usage - use the right watcher for the

You can also implement your "immediately after a callback" idea by
providing your own EV_INVOKE implementation (when embedding libev), if you
really needed it (which is not the case by your own description).

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_    
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at
      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list