how to defer an event notification

Marc Lehmann schmorp at schmorp.de
Sun Oct 20 12:10:01 CEST 2013


On Sat, Oct 19, 2013 at 06:52:48PM +0000, "Srini Gurusu (sgurusu)" <sgurusu at cisco.com> wrote:
> >watcher is the relatively costly memory synchronisation done by
> >ev_async_send.
> 
> For simplicity, if I use ev_sync_send(),
> Do we need to protect ev_sync_send() as this will be called by producer
> and 
> consumer as well on the same loop/watcher.

As long as the loop exists and the watcher is started, you should be able
to call ev_async_send at any time without any protection - same thread,
other thread, signal handler, inside a callback, outside a callback etc.
should all be fine.

It's the only function in libev that allows this.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list