[timers] - triggering at the same time

Marc Lehmann schmorp at schmorp.de
Sat Dec 17 00:31:01 CET 2011


On Thu, Dec 15, 2011 at 06:41:31PM -0800, Neeraj Rai <rneeraj at yahoo.com> wrote:
> 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 ?

With the corresponding data structure you can do that.

> 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.

If the limited number of priorities are enough for this, then that would
be the simplest solution.

> 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.

Thats basically option 1).

You could also collect all the timers that were invoked with their timeout
value and then execute them in the order you want in a prepare callback.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list