[Libevent-users] newbie question

Matt Pearson 404emailnotfound at gmail.com
Fri May 11 04:22:25 EDT 2007


On 5/10/07, beyondkaoru <beyondkaoru at gmail.com> wrote:
>
> will callbacks from events ever interrupt each other?
>
> if i have a socket which gets data, so its event handler starts running
> the function i told it to, and data comes in on another socket, can i be
> sure that the second event's function won't start until the first one is
> finished? or would i have to introduce mutexes and/or semaphores?

Libevent is inherently single-threaded, so it cannot preempt other
code that is running.  Another callback will be issued only after you
return from the callback, returning control to the event library.  The
fact that you don't have to worry about synchronization is one of the
main reasons for using asynchronous I/O over individual threads.


More information about the Libevent-users mailing list