several questions about libev

Jorge jorge at jorgechamorro.com
Wed Jul 4 16:59:05 CEST 2012


On 01/07/2012, at 22:04, Marc Lehmann wrote:

> Note that ev_async_pending is not documented to be call-able from another
> thread than the one that runs the event loop, so you shouldn't call it to
> see anything, because it does not do any kind of synchronisation. (...) 
> Literally the only call which is documented to be safe to call from
> another thread is ev_async_send. (...)


Oops, I've been writing this:

if (!ev_async_pending(&watcher)) ev_async_send(EV_DEFAULT_UC_ &watcher);

that expands to:

if (!(+(&watcher)->sent)) ev_async_send(ev_default_loop_uc_ (), &watcher);

In all my background (p)threads... 

Should I avoid that if (!watcher.sent) tests then?

-- 
Jorge.



More information about the libev mailing list