On Tue, Dec 20, 2011 at 02:34:52PM +0100, Hongli Lai <[email protected]> wrote: > I'm writing a multithreaded evented server in which I have N threads > (N=number of CPU cores) and one libev event loop per thread. I want to > use libeio but it looks like libeio depends on global variables so > this isn't going to work.
global variables are entirely fine with threads (libeio itself uses threads). > I'd like to request the ability to use libeio with multiple event > loops. This probably involves changing the API so that each libeio > function accepts a context object. You can already do that - lock around request submit calls and have a receiving thread that calls eio_poll and does whatever it needs to do to notify other threads. You could e.g. pthread_cond_signal in the want callback and wait for that in the receiving thread (thats tricky of course, a pipe is much simpler :) See http://lists.schmorp.de/pipermail/libev/2011q4/001585.html for soem discussion. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / [email protected] -=====/_/_//_/\_,_/ /_/\_\ _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
