[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] a dead looping bug when changing system time backward



On Wed, Apr 11, 2012 at 02:21:13AM +0300, Nir Soffer wrote:
<snip>
> Forward jumps should simply skip events in the past. It is just like  
> events skipped because the event loop was blocked.
> 
> If you should run every 5 seconds, but woke up 21 seconds late, you  
> cannot fix the past - you just missed the events at +5, +10, +15 and  
> +20. Run the next event at +25 according to the plan.
> 
> Other event loops like Cocoa NSRunloop and GNUStep NSRunloop use this  
> logic.
> 

Alternatively, periodic timers like timerfd on Linux or EVFILT_TIMER on BSD
allow you to query the number of times the timer fired before being
serviced. So although they may only signal once, the user code can still
execute N iterations of its task if it wishes.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.