Re: [Libevent-users] pipeline server
On Mon, Feb 25, 2008 at 02:32:00PM +0100, Chris Brody <[EMAIL PROTECTED]> wrote: > I would like to suggest that you take a look at libev > (http://software.schmorp.de/pkg/libev.html), which has a libevent > "compatibility" API but also has a number of watchers to deal with > multiple threads. I do not understand these at all, but maybe they > would make more sense to you. Well, I just hope you didn't read the ev_async documentation, as otherwise, it clearly fails to explain what they do :) In any case, its quite simple: all you can do with them is generate an event in another event loop that might currently be active in another thread, which is the basic building block one needs for inter-thread-communications. You would also need current cvs, as this has not yet been released, and be aware that some users experienced unspecified (and so far unreproducable) problems with slightly older cvs snapshots, so ymmv. -- The choice of a Deliantra, the free code+content MORPG -==- _GNU_ http://www.deliantra.net ==-- _ generation ---==---(_)__ __ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / [EMAIL PROTECTED] -=/_/_//_/\_,_/ /_/\_\ ___ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
Re: [Libevent-users] pipeline server
On 2/25/08, Tao Hui <[EMAIL PROTECTED]> wrote: > Hello, > > I want to implement a pipeline server build on libevent, it contains a > libevent thread and serval worker threads. libevent thread read request, > write result, and worker thread process the request. Which can be described > as follows: > > libevent thread: > 1. accept a new connection. > 2. register "EV_READ | EV_PERSIST" on the connection socket. > 3. read a full request from the socket under libevent loop. > 4. cancel the registration of socket through event_del, and add request to > request queue, >then pthead_cond_signal worker thread. > > worker thread: > 1. get a request from request queue, process it. > 2. add the result to result queue, and signal libevent thread through pipe. > > libevnet thread: > 1. get a result from result queue, register "EV_WRITE | EV_PERSIST" on the >connection socket associated with the result. > 2. write the result to the socket under libevent loop. I would like to suggest that you take a look at libev (http://software.schmorp.de/pkg/libev.html), which has a libevent "compatibility" API but also has a number of watchers to deal with multiple threads. I do not understand these at all, but maybe they would make more sense to you. CB ___ libev mailing list libev@lists.schmorp.de http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev