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

Re: [Libevent-users] Is bufferevent thread-safe?



On Wed, May 11, 2011 at 2:05 AM, Kun Xi <kunxi@xxxxxxxxx> wrote:
> Hello,
>
> I am a new user of libevent, so the question may seem quite naive.
>
> I am building an application based on libevent-2.10 on linux using the
> epoll backend. The application maintains BST using tsearch, tdelete
> for access control. The tree is built from the command line argument,
> and looked up when a new connection is accepted.
>
> I want to build a HTTP server to dynamically update the BST. I know
> that tsearch is not thread-safe, but since libevent uses async I/O, so
> I assume thread-safety is guaranteed. Could somebody confirm this?

Bufferevents and the Libevent core can be setup to be thread-safe:
just follow the "Locks and Threading" instructions at
http://www.wangafu.net/~nickm/libevent-book/Ref1_libsetup.html to tell
Libevent how to use your threading library, then make sure you use the
BEV_OPT_THREADSAFE option when constructing your bufferevents.

The evhttp* code is not currently threadsafe.

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