libev application stops responding and consumes 100% cpu

Konstantin Olkhovskiy lupus at oxnull.net
Tue Apr 8 10:02:34 CEST 2014


Hey,

2014-04-08 11:53 GMT+04:00 Kirill Timofeev <kvt at hulu.com>:

> while loop was copy pasted from example I used as starting point. While
> loop is needed to run program forever, but looks like adding event handlers
> should be done in the loop as well. Frankly speaking I don't understand how
> all watchers were dropped in my case.
>

As far as I can tell, it indeed runs your program forever consuming 100%
cpu.

The documentation on ev_run says the following:
> If the flags argument is specified as 0, it will keep handling events
until either no event
> watchers are active anymore or ev_break was called.

So I would suggest removing the while loop and double checking that
watchers are being active
all the time. If you cannot guarantee that, you can add some dummy watcher
which will be active.

Another approach is to play with ev_ref/ev_unref to make the loop think
it's still used.


-- 
Regards,
Konstantin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20140408/add8f8d6/attachment-0001.html>


More information about the libev mailing list