From 218a3c372c9eb0fab8325833342fa7e8e0ce8e86 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 13 May 2010 11:24:07 -0400 Subject: Do not check that event_base is set in EVBASE_ACQUIRE_LOCK In every place that we call EVBASE_ACQUIRE_LOCK, the base is either set, or must be set, so the test is redundant. --- evthread-internal.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'evthread-internal.h') diff --git a/evthread-internal.h b/evthread-internal.h index 620328e3..b2989b92 100644 --- a/evthread-internal.h +++ b/evthread-internal.h @@ -43,10 +43,6 @@ extern struct evthread_lock_callbacks _evthread_lock_fns; extern unsigned long (*_evthread_id_fn)(void); extern int _evthread_lock_debugging_enabled; -/** True iff the given event_base is set up to use locking */ -#define EVBASE_USING_LOCKS(base) \ - (base != NULL && (base)->th_base_lock != NULL) - /** Return the ID of the current thread, or 1 if threading isn't enabled. */ #define EVTHREAD_GET_ID() \ (_evthread_id_fn ? _evthread_id_fn() : 1) @@ -122,14 +118,12 @@ extern int _evthread_lock_debugging_enabled; /** Lock an event_base, if it is set up for locking. Acquires the lock in the base structure whose field is named 'lockvar'. */ #define EVBASE_ACQUIRE_LOCK(base, lockvar) do { \ - if (EVBASE_USING_LOCKS(base)) \ - _evthread_lock_fns.lock(0, (base)->lockvar); \ + EVLOCK_LOCK((base)->lockvar, 0); \ } while (0) /** Unlock an event_base, if it is set up for locking. */ #define EVBASE_RELEASE_LOCK(base, lockvar) do { \ - if (EVBASE_USING_LOCKS(base)) \ - _evthread_lock_fns.unlock(0, (base)->lockvar); \ + EVLOCK_UNLOCK((base)->lockvar, 0); \ } while (0) /** If lock debugging is enabled, and lock is non-null, assert that 'lock' is -- cgit v1.2.1