summaryrefslogtreecommitdiff
path: root/evthread-internal.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-09-08 14:00:45 -0400
committerNick Mathewson <nickm@torproject.org>2010-09-08 14:00:45 -0400
commit9580e282d7e5801802e935956902a1948525d474 (patch)
tree2c2c923ca712d43ca7afcde1355b11b79a14f4a4 /evthread-internal.h
parent57d3413c55689d623dad4eb2765d8a3bed9b586b (diff)
parentce85280beb56c4b1c7e69c542878a8f1fe647f28 (diff)
downloadlibevent-9580e282d7e5801802e935956902a1948525d474.tar.gz
Merge branch 'th_notify_fd_reinit'
Diffstat (limited to 'evthread-internal.h')
-rw-r--r--evthread-internal.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/evthread-internal.h b/evthread-internal.h
index b768a753..c6a8787e 100644
--- a/evthread-internal.h
+++ b/evthread-internal.h
@@ -56,12 +56,20 @@ extern int _evthread_lock_debugging_enabled;
#define EVTHREAD_GET_ID() \
(_evthread_id_fn ? _evthread_id_fn() : 1)
-/** Return true iff we're in the thread that is currently running a given
- * event_base's loop. */
+/** Return true iff we're in the thread that is currently (or most recently)
+ * running a given event_base's loop. Requires lock. */
#define EVBASE_IN_THREAD(base) \
(_evthread_id_fn == NULL || \
(base)->th_owner_id == _evthread_id_fn())
+/** Return true iff we need to notify the base's main thread about changes to
+ * its state, because it's currently running the main loop in another
+ * thread. Requires lock. */
+#define EVBASE_NEED_NOTIFY(base) \
+ (_evthread_id_fn != NULL && \
+ (base)->running_loop && \
+ (base)->th_owner_id != _evthread_id_fn())
+
/** Allocate a new lock, and store it in lockvar, a void*. Sets lockvar to
NULL if locking is not enabled. */
#define EVTHREAD_ALLOC_LOCK(lockvar, locktype) \
@@ -281,6 +289,7 @@ EVLOCK_TRY_LOCK(void *lock)
#define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) _EVUTIL_NIL_STMT
#define EVBASE_IN_THREAD(base) 1
+#define EVBASE_NEED_NOTIFY(base) 0
#define EVBASE_ACQUIRE_LOCK(base, lock) _EVUTIL_NIL_STMT
#define EVBASE_RELEASE_LOCK(base, lock) _EVUTIL_NIL_STMT
#define EVLOCK_ASSERT_LOCKED(lock) _EVUTIL_NIL_STMT