Hi!

On Mon, Feb 15, 2016 at 12:25:19PM +0100, Marc Lehmann wrote:
> 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.

But there are no other event watchers, so if this timer hasn't elapsed yet
when event loop returns then isn't that means event loop returns too early?
Isn't event loop must wait for at least one event if there are active
watchers when using EV::run(0) and EV::run(RUN_ONCE)?

If current behaviour is correct - is it possible to somehow find out is
RUN_ONCE did something (invoked callback for at least one watcher) or not?


My use case is testing event loop based modules/applications by using
RUN_ONCE to process and test events one-by-one… and when RUN_ONCE is
(sometimes) doing nothing I either have to somehow detect this case and
repeat RUN_ONCE, or don't use RUN_ONCE at all and add EV::break to all
event handlers to emulate it (which isn't ease or even possible for event
handlers defined outside of test's code).

-- 
                        WBR, Alex.

_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/libev

Reply via email to