C++ How TO?

Praveen Baratam praveen.baratam+libev at gmail.com
Wed Dec 15 23:26:51 CET 2010

My apologies for the garbled and illegible code.

I am attaching the source file to this email.

void runLoop()
ev_run(_loop, EVRUN_ONCE);

_io_service.post(boost::bind(&FileService::runLoop, this));

-------> As the callbacks are initiated from with in the
"ev_run"function call, i thought that watchers could be added or
deleted before the next loop is scheduled from with in those
callbacks. So i am checking the counter before scheduling the next

IO_Service class is actually a FIFO task scheduler. All we do is add
tasks to the scheduler. Adding watchers, deleting watchers and running
the loop are just tasks to the IO_Service.

As far as i could comprehend from Libev docs

*ev_set_io_collect_interval (_loop, _poll_interval);*

sets a time out for the loop, so there is no indefinite wait for the
loop to finish. (Please correct me if I am wrong). As soon as the loop
times-out or finishes, the next run is scheduled in the queue and
before that other tasks such as adding and deleting watchers can
execute if they are in the queue.

Thank you for your time reviewing the code.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20101216/1d26b5b1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestFS.cpp
Type: text/x-c++src
Size: 6189 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20101216/1d26b5b1/attachment.cpp>

More information about the libev mailing list