[Libevent-users] How to schedule a plain event
Hi, how is it possible to schedule a callback in the next eventloop iteration? Of course i could add a timer event with timeout 0 but this seems like a lot of overhead. I just want a function to be called in the next event iteration (i can't call it directly in another libevent callback because the first callback is called inside the buffer_chain_free method and the method itself wants to write to the buffer). ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] How to schedule a plain event
On Mon, Jul 13, 2009 at 02:29:21PM +0200, q6Yr7e0o nIJDVMjC wrote: Hi, how is it possible to schedule a callback in the next eventloop iteration? Of course i could add a timer event with timeout 0 but this seems like a lot of overhead. I just want a function to be called in the next event iteration (i can't call it directly in another libevent callback because the first callback is called inside the buffer_chain_free method and the method itself wants to write to the buffer). The easiest thing to do here is to use the event_active() call to make the event active now. But it doesn't do quite what you asked for: the callback will be run later in the current iteration of the loop, not in the next iteration. If it needs to be in the next iteration, I can't offhand think of a better way than adding an event with a 0 callback. yrs, -- Nick ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users
Re: [Libevent-users] How to schedule a plain event
Hi The easiest thing to do here is to use the event_active() call to make the event active now. But it doesn't do quite what you asked for: the callback will be run later in the current iteration of the loop, not in the next iteration. If it needs to be in the next iteration, I can't offhand think of a better way than adding an event with a 0 callback. no that's exactly what I need. I just have to return form the callback function because buffer_chain_free has to finish and after that the new function can be called. Thanks :-) ___ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users