On Fri, Oct 30, 2009 at 11:34:43PM +0800, Zhuang Yuyao wrote: > Hi, > > I am wondering if anyone could show me some sample code of using > evconnlistener with multi-threaded connection handlers. > > I've read the multi-thread code in memcached. in libevent 2.x, there > are some functions (ie. evthread_use_pthreads(), > evthread_make_base_notifiable(), event_queue_insert(), > event_queue_remove()) which look like the "official" implementation of > event notification cross threads. but after reading regress_pthread.c > (the only sample code bundled with libevent 2.x which contains > evthread_make_base_notifiable()), I still can not figure out how to > use evconnlistener() with multi-threaded connection handlers.
There is no code yet for explicitly having callbacks happen in multiple threads. The multithreading stuff in Libevent 2.0 is there to make it possible to use a single event base from multiple threads, but it doesn't handle having the callbacks done by a thread pool. That is a feature we'd like to add, especially if some volunteer contributes a patch for it, but it may need to wait for Libevent 2.1. yrs, -- Nick *********************************************************************** To unsubscribe, send an e-mail to [email protected] with unsubscribe libevent-users in the body.
