On Fri, Jun 3, 2011 at 12:34 AM, Marc Lehmann <schm...@schmorp.de> wrote:

> As for 0, we indeed don't need to care, but introducing this special case
> would make the timeout values nonproportional to the actual time. And that
> in turn would destroy the property that adding something to a timeout
> value will make the timer fire this much earlier or later (within the
> limits of libev's control).
>
> I think having time run strictly monotonously is more important than the
> special case of a 0-second timer - a 0 second timer is definitely NOT a
> special case for the user of libev.
>
>
Right. I agree this property shouldn't become broken.



>  > It is possible to use ev_timer(-1) but that's not as clear as
> ev_timer(0).
>
> Why would anybody want to use specifically a 0-second timer (where the 0
> isn't just the chance result of some calculation)?
>
> The only reason I can know from past experience is that some people try
> to abuse 0-second timers as some replacement for idle watchers, possibly
> because that hack was the only way to get some kind of idle behaviour with
> some other event loop.
>

Well, in gevent, people sometimes use sleep(0) as a way to yield to other
current coroutines.

However, I can also handle 0 separately in sleep(), make it use ev_idle or
ev_check in that case.
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to