Busy looping when there are no active watchers
schmorp at schmorp.de
Thu Jul 5 01:28:19 CEST 2012
On Wed, Jul 04, 2012 at 09:37:54PM +0000, doug at hcsw.org wrote:
> I've noticed that if there are no active watchers, waiting on a
> condition variable busy loops with AnyEvent (only tried it with
> AnyEvent 7.01 and EV backend):
Yes, when your program deadlocks, this happens with some event loops.
> I'm not saying I think this behaviour is wrong since a program
> where there are no active watchers is probably broken in some
> other way, I'm just wondering why the busy looping happens in
> this case. I kind of thought it would "sleep forever".
With EV, the reason it happens is that EV::loop returns when there are no
active watchers, and AnyEvent just calls it until the condition becomes
> Sorry if I missed this in the documentation.
The reason why it happens is not documented for each event loop, but
AnyEvent::FAQ generally talks about "Why do some backends use a lot of CPU
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 anyevent