On Thu, Jun 25, 2009 at 12:39 PM, Adrian Chadd<adr...@creative.net.au> wrote: > I didn't think this was documented. As such, why would you expect them > to fire in-order? :)
On Thu, Jun 25, 2009 at 12:53 PM, Clint Webb<webb.cl...@gmail.com> wrote: > If you need things to happen in a particular order, you need to sequence > your timeouts from each other. In an event based system, you cannot > guarantee the order that the events will be fired. Why not? There is nothing that prevents the scheduler to fire such events in the order they were added. In fact, that what libevent seems to do when I call event_add() before entering the loop. However, if I do the same inside a callback, the order is exactly reversed except for the first event. This suggests that (although I haven't looked through the code, so I might be wrong) this is accidental and libevent can be fixed to behave like that, but nobody needed such feature so far. It could also be that this is by design or that it's impossible to implement without performance penalty, in which case it's not worth bothering. Could someone familiar with the code shed the light on this? I am implementing libevent hub for eventlet [1] and it has come to depend on such behavior, so I had to work around the issue. I don't like the workaround though. [1] http://bitbucket.org/denis/eventlet/ _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users