Calling ev_async_send() from multiple threads.

Gabriel Kerneis kerneis at
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

> ev_async_send (loop, ev_async *): […] feeds an EV_ASYNC event on the watcher
> into the event loop, and instantly returns.

Best regards,

More information about the libev mailing list