Callbacks Question

Marc Lehmann schmorp at
Sun Jan 6 22:36:26 CET 2008

On Tue, Jan 01, 2008 at 12:07:59PM -0700, Matt Tolton <matt at> wrote:
> > I don't understand the reasoning. A watcher can be pending within its own
> > callback (because it can become pending while executing the callback, e.g.
> > when recursing into ev_loop).
> Ok.  I didn't think about this situation.  Why would you want to
> recurse into ev_loop?

Good question, it usually just happens to be handy at times :)

> Are there any other ways besides recursing into
> ev_loop that might put it into the pending state?

Yes, calling ev_feed_*.

> > if you do "interesting" stuff in your callback and are not sure wether you
> > recurse again into the event loop or so, the safe route is to always call
> > ev_xxx_stop first, but this is unliekly to be necessary.
> What counts as "interesting" stuff?  What calls into libev do I need
> to be aware of that might recurse (aside from calling ev_loop again)?

None of the calls in libev recurse themselves, its always the program, or
none. The interestign stuff is feeding events yourself.

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

More information about the libev mailing list