diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-11-27 16:44:47 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-11-27 17:36:51 -0500 |
commit | 76cd2b70bb64962636cba0073571d0694b9c237a (patch) | |
tree | 42519b66630688712b528d0cb0cf1855c0ad0a92 /evthread-internal.h | |
parent | 347952ffe0039369ff4e7c94c4e27e7333ba8ecb (diff) | |
download | libevent-76cd2b70bb64962636cba0073571d0694b9c237a.tar.gz |
Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Previously, our default lock model kind of assumed that every lock was
potentially a read-write lock. This was a poor choice, since
read-write locks are far more expensive than regular locks, and so the
lock API should only use them when we can actually take advantage of
them. Neither our pthreads or win32 lock implementation provided rw
locks.
Now that we have a way (not currently used!) to indicate that we
really want a read-write lock, we shouldn't actually say "lock this
for reading" or "lock this for writing" unless we mean it.
Diffstat (limited to 'evthread-internal.h')
-rw-r--r-- | evthread-internal.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/evthread-internal.h b/evthread-internal.h index 623bac9e..b7da22d4 100644 --- a/evthread-internal.h +++ b/evthread-internal.h @@ -118,16 +118,16 @@ extern unsigned long (*_evthread_id_fn)(void); /** Lock an event_base, if it is set up for locking. Acquires the lock - in the base structure whose field is named 'lck'. */ -#define EVBASE_ACQUIRE_LOCK(base, mode, lockvar) do { \ + 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(mode, (base)->lockvar); \ + _evthread_lock_fns.lock(0, (base)->lockvar); \ } while (0) /** Unlock an event_base, if it is set up for locking. */ -#define EVBASE_RELEASE_LOCK(base, mode, lockvar) do { \ +#define EVBASE_RELEASE_LOCK(base, lockvar) do { \ if (EVBASE_USING_LOCKS(base)) \ - _evthread_lock_fns.unlock(mode, (base)->lockvar); \ + _evthread_lock_fns.unlock(0, (base)->lockvar); \ } while (0) #else /* _EVENT_DISABLE_THREAD_SUPPORT */ @@ -141,8 +141,8 @@ extern unsigned long (*_evthread_id_fn)(void); #define EVLOCK_UNLOCK2(lock1,lock2,mode1,mode2) _EVUTIL_NIL_STMT #define EVBASE_IN_THREAD(base) 1 -#define EVBASE_ACQUIRE_LOCK(base, mode, lock) _EVUTIL_NIL_STMT -#define EVBASE_RELEASE_LOCK(base, mode, lock) _EVUTIL_NIL_STMT +#define EVBASE_ACQUIRE_LOCK(base, lock) _EVUTIL_NIL_STMT +#define EVBASE_RELEASE_LOCK(base, lock) _EVUTIL_NIL_STMT #endif |