libev application stops responding and consumes 100% cpu
lupus at oxnull.net
Tue Apr 8 10:02:34 CEST 2014
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%
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libev