Hi, Patrick Clochesy I guess you need a half-aync/half-sync thread pool. The main event loop thread (half-async) "handles all the accepts", and the "two other types of threads" (half-sync) are in charge of authenticating.
If so, i suggest you to take a look for the SPServer . > SPServer is a server framework, it implements: > 1.An Accepter for TCP Server > 2.An asynchronous layer. It has only one thread ( event loop thread ), > 3.A synchronous layer. It has multiple threads. > 4.A queue between asynchronous layer and synchronous layer. http://code.google.com/p/spserver/ http://spserver.googlecode.com/files/spserver-0.3.src.tar.gz Best regards, liusifan 2007-06-08 >>>Here's a quick synopsis for those who don't want to read the whole >explanation :) Is it possible to create events in threads that will >fire in the main thread if the access to event_set is mutually >exclusive? > >Longer explanation: >After I already implemented a multithreaded server based on libevent, >I saw Steven's message about the threading support. I basically have >one thread which does all the I/O, two other types of threads. > >The first handles all the accepts and sends a welcome message to each >new thread (using libevent if the call to write() doesn't write all >the bytes). The second is actually a group of threads which are in >charge of authenticating. > >I had planned on all the threads being able to be able to create new >write events using libevent, since the accept()ing threads need to >send the protocol "welcome" and also create a read event for when data >arrives, and the authentication threads need to send back to the >client whether they authenticated or not. > >However, before having seen this I implemented it, and the event_set >in the accept() thread is creating an event that is fired in the main >threads event_dispatch(). So, is it okay to continue on this path if I >assure the access of the libevent objects are mutually exclusive? > >Thanks, >-Patrick >_______________________________________________ >Libevent-users mailing list >Libevent-users@monkey.org >http://monkey.org/mailman/listinfo/libevent-users
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users