On 10/19/13 9:09 AM, "Marc Lehmann" <schm...@schmorp.de> wrote:
>On Fri, Oct 18, 2013 at 01:49:09PM +0000, "Srini Gurusu (sgurusu)" ><sgur...@cisco.com> wrote: >> I am using async watchers ( one per each queue with priority associated >>). >> Can I call ev_async_send() within the async watcher callback context to >>defer(resend within consumer context on behalf of producer) the >>remaining processing at later time? > >Ok, it's not absolitely clear to me what you are trying to do, but I >assume >that your watcher sometimes decides that it doesn't want to do things now, >but only in the next iteration of the event loop. Yes, this is what exactly I wanted to. > >The fastest way would probably to start an ev_check watcher, which is then >invoked after polling for new events (or ev_prepare, which is invoked >after all other callbacks in the current iteration). Thanks for the suggestions. I would try this. > >It is entirely fine to call ev_async_send from within the ev_async >callback, >too - the callback will then simply be invoked in the next iteration. The >only drawback over an ev_check (or even ev_idle, depending on your >semantics) >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. > >-- > The choice of a Deliantra, the free code+content >MORPG > -----==- _GNU_ http://www.deliantra.net > ----==-- _ generation > ---==---(_)__ __ ____ __ Marc Lehmann > --==---/ / _ \/ // /\ \/ / schm...@schmorp.de > -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev