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

Re: [Libevent-users] Does an event loop support multiple threads?

On Tue, May 22, 2012 at 1:13 PM, Hassink, Brian
<Brian.Hassink@xxxxxxxxxxx> wrote:
> Hello list,
> I’m new to libevent and trying to learn some more about it for potential use
> in a project.  I’ve worked with ACE reactor and ASIO proactor in the past,
> and after briefly skimming the “book”, am wondering about multi-threaded
> support in libevent.  When I look at R2 and R3, and some of the asynchronous
> IO examples, it’s not clear whether multiple threads can be running/using
> the same event_base instance.

Nope, not at present.

If you want to do a multithreaded design like that with any current
version of Libevent, either you need multiple event_bases (one per
thread), and some means to load-balance connections between them, or
you need some kind of thread pool + work queue system to handle the
work of distributing your callbacks across different processors.

To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.