[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] When to use multiple bases?



Hey, I use a base for each thread. Usually one thread for all the listeners. And multiple threads for read write on sockets. It usually scales pretty well. Nonetheless, there is no one correct answer. It really depends on the application you plan to implement and on the requirements.

Sent from my iPhone

> On Feb 21, 2014, at 7:03 PM, "Jeffrey Walton" <noloader@xxxxxxxxx> wrote:
> 
> Hi Guys,
> 
> Here's another question form the beginer's guide, so please forgive my
> ignorance.
> 
> I was looking at 'hello-world.c', and I see it uses a single base to
> to wait fro incoming connections (via
> listener/evconnlistener_new_bind) and and SIGINT (via
> signal_event/evsignal_new).
> 
> My question is, when is it recommended or appropriate to use a second,
> distinct base?
> 
> Should a second based be used if a second listener is needed (i.e.,
> listen on ports 80 and 443)?
> 
> Should a second base be used if a different signal handler is desired
> (i.e., SIGKILL or SIGTERM)?
> 
> Or should a second base be used if a second thread is used and wants
> to wait for events (and not share the other thread's base)?
> 
> (I've probably read the answer in Mathewson online book, but I'm not
> connecting the dots at the moment).
> 
> Thanks in advance.
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.