[Libevent-users] pipeline server
Tao Hui
taohui3 at gmail.com
Mon Feb 25 02:15:17 EST 2008
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://monkeymail.org/archives/libevent-users/attachments/20080225/374a1f1d/attachment.htm
More information about the Libevent-users
mailing list