Add support for internal libevent threading support. Add configure logic to define an appropriate flag, and then use that flag to expose the required functions.
This commit was SVN r24088.
Этот коммит содержится в:
родитель
aa467162da
Коммит
380835602c
@ -66,6 +66,12 @@ int opal_event_base_open(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Declare our intent to use threads. If event library internal
|
||||
* thread support was not enabled during configuration, this
|
||||
* function defines to no-op
|
||||
*/
|
||||
opal_event_use_threads();
|
||||
|
||||
/* get our event base */
|
||||
if (NULL == (opal_event_base = opal_event_base_create())) {
|
||||
rc = OPAL_ERROR;
|
||||
|
@ -96,8 +96,13 @@ AC_DEFUN([MCA_opal_event_libevent207_CONFIG],[
|
||||
|
||||
AC_ARG_ENABLE(event-thread-support,
|
||||
AC_HELP_STRING([--enable-event-thread-support], [enable event library internal thread support]))
|
||||
if test "$enable_event_thread_support" = "no"; then
|
||||
if test "$enable_event_thread_support" = "yes"; then
|
||||
AC_DEFINE_UNQUOTED(OPAL_EVENT_HAVE_THREAD_SUPPORT, 1,
|
||||
[Thread support was configured into the event library])
|
||||
else
|
||||
event_args="$event_args --disable-thread-support"
|
||||
AC_DEFINE_UNQUOTED(OPAL_EVENT_HAVE_THREAD_SUPPORT, 0,
|
||||
[Thread support was not configured into the event library])
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([$event_args])
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include "opal/mca/event/base/base.h"
|
||||
|
||||
#include "libevent/event.h"
|
||||
#include "libevent/include/event2/thread.h"
|
||||
|
||||
#include "opal/mca/event/event.h"
|
||||
|
||||
@ -79,6 +80,17 @@ OPAL_DECLSPEC opal_event_base_t* opal_event_base_create(void);
|
||||
|
||||
OPAL_DECLSPEC int opal_event_init(void);
|
||||
|
||||
/* thread support APIs */
|
||||
#if OPAL_EVENT_HAVE_THREAD_SUPPORT
|
||||
#ifdef WIN32
|
||||
#define opal_event_use_threads(x) evthread_use_windows_threads(x)
|
||||
#else
|
||||
#define opal_event_use_threads(x) evthread_use_pthreads(x)
|
||||
#endif
|
||||
#else
|
||||
#define opal_event_use_threads(x)
|
||||
#endif
|
||||
|
||||
/* Basic event APIs */
|
||||
#define opal_event_base_finalize(x) event_base_free((x))
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user