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

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



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.

 

The project I’m working on involves up to 2000 “active” connections.  My initial thought was that the associated read and write events would be pending in the same event_base instance, and that a thread pool would be used to handle them concurrently.  Would I have each thread in the pool invoke event_base_dispatch() with the same event_base instance?

 

If this type of multi-threaded usage is not supported, how would one tackle a large number of “active” connections with libevent?

 

Regards,

Brian Hassink