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

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



Thanks for the confirmation Nick.

Balancing the connections across event_base instances is tricky since their traffic loads are variable.

And if I take the thread pool + work queue approach, I end up with something that look a lot like an ACE reactor ;)

Regards,
Brian Hassink

-----Original Message-----
From: owner-libevent-users@xxxxxxxxxxxxx [mailto:owner-libevent-users@xxxxxxxxxxxxx] On Behalf Of Nick Mathewson
Sent: Tuesday, May 22, 2012 1:22 PM
To: libevent-users@xxxxxxxxxxxxx
Subject: 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.

yrs,
-- 
Nick
***********************************************************************
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.