On Thu, Dec 12, 2013 at 10:12:57AM +1100, Varun Chandramohan <cvarunen...@gmail.com> wrote: > Thanks for the reply. Not sure why the code formatting is weird. I started > using async watchers and it helped. I got it working with that.
Just keep in mind that ev_async_send is the only function you are allowed to call cuncorrently from multiple threads :) > remove one other thread as I felt it was not needed with async watcher. > My solution is to use thread 1 to read from socket a packet add it to queue > and immediately notify the async watcher of data available. I also added > mutex lock to avoid race condition. Everything seem to be working well > as expected. I have currently put the code under stress test. Thanks for > the help. Sounds cool. I forgot to mention that the EV::Loop::Async module is a working example of this technique as well, using mutexes to protect the loop and using async watchers to wake up the event loop to take note of any changes. -- 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