On Thu, Nov 08, 2007 at 10:21:27PM +0100, Marc Lehmann wrote:
 [...]
> Its there now (I updated the tarball), the libev equivalent is
> ev_feed_event. I don't really feel well about exposing it, though, without
> actually having a use case that isn't served better by simply calling the
> callback immediatelly.

The main advantage to using event_active() for activating events
rather than calling the callback directly is that you don't need to
worry about call loops.  In other words, if event A's callback
sometimes calls event_active(B), and B's callback sometimes calls
event_active(A), you don't need to worry about stack overflow.

Also, if you have a lot of events to service, and some of them
will get activated by libevent and some of them will get activated
manually, using event_active() ensures that you don't starve the
libevent-activated events while all of the other events are calling
each other's callbacks.

(That's Tor's use-case for this, at any rate.)

cheers,
-- 
Nick Mathewson

Attachment: pgpih8zAxtniw.pgp
Description: PGP signature

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to