how to defer an event notification

Srini Gurusu (sgurusu) sgurusu at
Sat Oct 19 20:52:48 CEST 2013

On 10/19/13 9:09 AM, "Marc Lehmann" <schmorp at> wrote:

>On Fri, Oct 18, 2013 at 01:49:09PM +0000, "Srini Gurusu (sgurusu)"
><sgurusu at> 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
>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
>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
>watcher is the relatively costly memory synchronisation done by

For simplicity, if I use ev_sync_send(),
Do we need to protect ev_sync_send() as this will be called by producer
consumer as well on the same loop/watcher.

>                The choice of a       Deliantra, the free code+content
>      -----==-     _GNU_    
>      ----==-- _       generation
>      ---==---(_)__  __ ____  __      Marc Lehmann
>      --==---/ / _ \/ // /\ \/ /      schmorp at
>      -=====/_/_//_/\_,_/ /_/\_\

More information about the libev mailing list