Calling ev_async_send() from multiple threads.

Gabriel Kerneis kerneis at pps.jussieu.fr
Tue Jun 26 12:59:45 CEST 2012


On Tue, Jun 26, 2012 at 12:00:57PM +0200, Marek wrote:
> Now my question is if the flow->B_notify() will end only after the
> iterate_cb() function returns (so the iterate_cb will be running
> with mutex still locked!)? Or rather flow->B_notify() is called,
> inside the B_notify the watcher is triggered (but the callback
> doesn't launch), B_notify() returns,the mutex is unlocked and only
> after that libev runs iterate_cb as a this->async_watcher callback ?

The latter, it returns instantly (the callback is delayed).  Quoting the
documentation:

> ev_async_send (loop, ev_async *): […] feeds an EV_ASYNC event on the watcher
> into the event loop, and instantly returns.
    <http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Watcher_Specific_Functions_and_Data_-12>

Best regards,
-- 
Gabriel



More information about the libev mailing list