Adding watchers on the fly to event loops

Aravindh Ramaswamy aravindhramu at gmail.com
Thu Jul 18 13:27:24 CEST 2013


Perfect ! Thanks Marc ! :-)


On Thu, Jul 11, 2013 at 9:03 AM, Marc Lehmann <schmorp at schmorp.de> wrote:

> On Wed, Jul 10, 2013 at 05:05:45PM +0530, Aravindh Ramaswamy <
> aravindhramu at gmail.com> wrote:
> > Correct but that would require synchronization mechanisms between two
> > threads( as is the case for me) like mutexes and condition variables.
>
> Yes, but that's true for any communication between threads, or anything
> that potentially runs in parallel.
>
> > I considered the use of the queue but since watchers can pass custom data
> > as well
> > by type casting, I thought of passing the data using ev_async watcher in
> > ev_async_send
>
> first, ev_async_send is a synchronisation mechanism, and second, it has
> no meaningful way to queue data that wouldn't require you to use another
> synchronisatzion mechanism (like mutexes, atomic accesses &c).
>
> > and then the recipient event loop while invoking the async_cb can make
> use
> > of that information.
> > Wont that work ?
>
> Sure, but you can't escape the fundamental need for some synchronisation
> mechanism.
>
> --
>                 The choice of a       Deliantra, the free code+content
> MORPG
>       -----==-     _GNU_              http://www.deliantra.net
>       ----==-- _       generation
>       ---==---(_)__  __ ____  __      Marc Lehmann
>       --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
>       -=====/_/_//_/\_,_/ /_/\_\
>



-- 
Thanks and Regards,
Aravindh.R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20130718/430a7303/attachment.html>


More information about the libev mailing list