libev thread unsafe api
blblack at gmail.com
Sat Jan 14 12:44:37 CET 2012
On Sat, Jan 14, 2012 at 1:23 AM, Zaheer Ahmad <zaheer.mot at gmail.com> wrote:
> "Whenever you want to start/stop a watcher or do other modifications to
> an event loop," so its unclear to me which other api are not thread safe
> apart from "ev_<>_start/stop". Are ev_<>_init, ev_feed_event,
> ev_clear_pending, ev_async_send safe?
ev_async_send() is explicitly documented as thread-safe. For other
functions, as you've quoted above: if they modify the event loop, they're
not thread-safe. So from your list, ev_feed_event() and ev_clear_pending()
are not thread-safe because they modify an event loop. ev_X_init doesn't
touch the loop, but it's as safe as any other variable initialization. It
doesn't do any internal locking, so two concurrent ev_X_init on the same
memory from different threads of execution would be unsafe.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the libev