Discussion:
When to use multiple bases?
(too old to reply)
Jeffrey Walton
2014-02-21 17:03:15 UTC
Permalink
Raw Message
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 ***@freehaven.net with
unsubscribe libevent-users in the body.
Ralph Castain
2014-02-21 17:13:12 UTC
Permalink
Raw Message
Post by Jeffrey Walton
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)?
I wouldn't necessarily use it in those cases, but one could do so
Post by Jeffrey Walton
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 use it for this case - any time I need a separate progress thread
Post by Jeffrey Walton
(I've probably read the answer in Mathewson online book, but I'm not
connecting the dots at the moment).
Thanks in advance.
***********************************************************************
unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.
Tomer Heber
2014-02-21 18:08:41 UTC
Permalink
Raw Message
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
Post by Jeffrey Walton
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.
***********************************************************************
unsubscribe libevent-users in the body.
***********************************************************************
To unsubscribe, send an e-mail to ***@freehaven.net with
unsubscribe libevent-users in the body.

Loading...