unreliable timer with RUN_ONCE since 4.10

Marc Lehmann schmorp at schmorp.de
Mon Feb 15 12:25:19 CET 2016


On Sun, Feb 14, 2016 at 06:15:39PM +0200, Alex Efros <powerman at powerman.name> wrote:
> The example is in Perl, but I suppose issue is with libev, not EV.
> EV-4.03 doesn't have this issue, EV-4.10 to 4.22 have this issue.
> It may be related to improvement for low resolution clock mentioned in
> this list for 4.10 (May 2011).
> 
> Problem is: timer for < 1sec doesn't invoked by first RUN_ONCE.

I'm not quite sure what the problem is - RUN_ONCE doesn't wait for
specific events, it simply runs the event loop once, and it seems to work as
it should in your example.

If I run your script, then the reason the timer isn't invoked instantly
is simply because it hasn't elapsed yet - try with delay -1 for example,
then it will be invoked instantly. For positive delays, it will only be
triggered when it's time has elapsed.

> With 0.9 sec versions 4.10-4.22 works unreliably: sometimes timer invoked
> by first RUN_ONCE, sometimes not - so I've used 0.1 and 1 sec in this
> example.

I am not sure why you think it is unreliable - 0.9 means "after 0.9 seconds",
not before.

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