[timers] - triggering at the same time

Neeraj Rai rneeraj at yahoo.com
Sun Dec 18 19:32:50 CET 2011


> ok, here is what libev is doing:
> 
>    invoke prepare watchers
>    poll kernel for new events
>    invoke check watchers
>    invoke other watchers
>    repeat...
> 
> or in other words, all timers will be invoked, then prepare
> watchers, and then it might block for new events.
> 
> the idea is to collect all invoked timers, i.e. when their
> callback is called, push them into a list and start a prepare watcher.
> 
> the prepare watcher will be run AFTER all outstanding
> timers have been invoked but BEFORE the loop sleeps again. 
>
> in the prepare watcher, you then have a (smallish) list of
> timers that are pending, and you can sort that yourself, presumably, and
> then call them in the right order.
ok, this makes it more clear. thanks, will try it.

> I'll have a look and see if its feasible to support a
> strict timer ordering.
thanks.

> otoh, why do you need the strict timer ordering? maybe your
> goal can be achieved without it?
We have certain resources that become available at certain times- the 
times are controlled by config and subject to change.
When users come in looking to use the resource, and the resource is not 
available, the request is queued to trigger at the specic time (cfg based)
When the time arrives, we want to give the resourse to users in the order
they requested.

thanks
Neeraj




More information about the libev mailing list