[timers] - triggering at the same time

Neeraj Rai rneeraj at yahoo.com
Fri Dec 16 03:41:31 CET 2011


Hi,
 
I read the libev docs that if multiple relative timers with same timeout value are ready,
the order of invocation is undefined.
I have a use case, where same timeout by specified by users of my code and I want to 
preserve the order of call when triggering timeouts.
 
What is the best way to acheive this in libev ? 3 ways I could think of  -
1. if I can find out that there is already a timer at the time I am adding, I can fudge the 
timer to have timeout+.0001 to make it trigger later. Is this possible ?
2. can I set priority on the timers. Because then I could maintain running seqno and inc
it on each call to denote the later ones trigger later.
3. I need to maintain my timers in sorted timed buckets (probably similar to what libev 
does internally) and detect the time collision before adding the timer.
Any other suggestions will be appreciated.
 
thanks
Neeraj

==================================================
arguments are a "win win" situations. Each party goes away thinking they won.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20111215/7043bbb8/attachment.html>


More information about the libev mailing list