summaryrefslogtreecommitdiff
path: root/evthread-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-14 17:33:02 -0500
committerNick Mathewson <nickm@torproject.org>2011-11-14 17:33:02 -0500
commite78741332985be96f2a44e71226b4adfe55aee7e (patch)
tree2fe0a6db4c7afd03bfc2261ad5d6136a8488f14c /evthread-internal.h
parent4e797f388f736756b1531ce47ef210bd2119515f (diff)
downloadlibevent-e78741332985be96f2a44e71226b4adfe55aee7e.tar.gz
Don't try to make notifiable event_base when no threading fns are configured
Diffstat (limited to 'evthread-internal.h')
-rw-r--r--evthread-internal.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/evthread-internal.h b/evthread-internal.h
index 60f02e00..65d30f8b 100644
--- a/evthread-internal.h
+++ b/evthread-internal.h
@@ -173,6 +173,10 @@ EVLOCK_TRY_LOCK(void *lock)
#define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
( (cond) ? _evthread_cond_fns.wait_condition((cond), (lock), (tv)) : 0 )
+/** True iff locking functions have been configured. */
+#define EVTHREAD_LOCKING_ENABLED() \
+ (_evthread_lock_fns.lock != NULL)
+
#elif ! defined(_EVENT_DISABLE_THREAD_SUPPORT)
unsigned long _evthreadimpl_get_id(void);
@@ -185,6 +189,7 @@ void *_evthreadimpl_cond_alloc(unsigned condtype);
void _evthreadimpl_cond_free(void *cond);
int _evthreadimpl_cond_signal(void *cond, int broadcast);
int _evthreadimpl_cond_wait(void *cond, void *lock, const struct timeval *tv);
+int _evthreadimpl_locking_enabled(void);
#define EVTHREAD_GET_ID() _evthreadimpl_get_id()
#define EVBASE_IN_THREAD(base) \
@@ -281,6 +286,9 @@ EVLOCK_TRY_LOCK(void *lock)
#define EVTHREAD_COND_WAIT_TIMED(cond, lock, tv) \
( (cond) ? _evthreadimpl_cond_wait((cond), (lock), (tv)) : 0 )
+#define EVTHREAD_LOCKING_ENABLED() \
+ (_evthreadimpl_locking_enabled())
+
#else /* _EVENT_DISABLE_THREAD_SUPPORT */
#define EVTHREAD_GET_ID() 1
@@ -307,6 +315,8 @@ EVLOCK_TRY_LOCK(void *lock)
#define EVTHREAD_COND_WAIT(cond, lock) _EVUTIL_NIL_STMT
#define EVTHREAD_COND_WAIT_TIMED(cond, lock, howlong) _EVUTIL_NIL_STMT
+#define EVTHREAD_LOCKING_ENABLED() 0
+
#endif
/* This code is shared between both lock impls */