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

[Libevent-users] New libevent user with some questions



Hello all-

I'm a new user using libevent 2.0.2a.  While the documentation on wangafu has helped me get started, I've got a couple basic questions then a couple of advanced questions.

1)  Does the event loop free completed, nonpersisted events?

2)  I'm developing a event-driven socket server that will eventually use bufferevents that also incorporates async database calls, for a multicore server.  Does it make sense to have multiple threads, each with their own event base?  If so, do any of you have suggestions on ways to structure stuff for optimal performance?  Also, is there any way to tell how many events are currently attached to an event base so I could balance the number of events being watched by each thread?

3)  What is the minimum I need to do to set up libevent so it's threadsafe?  Also, are the read/write buffers for bufferevents threadsafe?  An example would be really helpful....I'm not much of a C coder (I'm actually developing this in common lisp using FFI) so I'm not totally conversant in raw pthreads and stuff.

4)  Can I pass the read/write buffers around to different events as the arg argument, or even to different threads?  The gist that I got from the docs is that they could be used for nonblocking IO.

5)  Can I flush the output buffer automatically when the underlying socket is asked to close?

Thanks for your help 
Mike Kohout