how to defer an event notification
Marc Lehmann
schmorp at schmorp.de
Sat Oct 19 18:09:27 CEST 2013
On Fri, Oct 18, 2013 at 01:49:09PM +0000, "Srini Gurusu (sgurusu)" <sgurusu at 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.
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).
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.
--
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