[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] about exit when using flag EVLOOP_NO_EXIT_ON_EMPTY
On Sun, Jul 8, 2012 at 8:07 AM, debuguo <wateraworld@xxxxxxxxx> wrote:
> " enable threading before creating your event base "
> could you explain more about it?
Have a look at the "Locks and threading" section of
http://www.wangafu.net/~nickm/libevent-book/Ref1_libsetup.html
Excerpt:
=========
To get locking in Libevent, you must tell Libevent which locking
functions to use. You need to do this before you call any Libevent
function that allocates a structure that needs to be shared between
threads.
If you are using the pthreads library, or the native Windows threading
code, you’re in luck. There are pre-defined functions that will set
Libevent up to use the right pthreads or Windows functions for you.
Interface:
#ifdef WIN32
int evthread_use_windows_threads(void);
#define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED
#endif
#ifdef _EVENT_HAVE_PTHREADS
int evthread_use_pthreads(void);
#define EVTHREAD_USE_PTHREADS_IMPLEMENTED
#endif
=====================
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.