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 /bufferevent-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 'bufferevent-internal.h')
-rw-r--r-- | bufferevent-internal.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bufferevent-internal.h b/bufferevent-internal.h index 732646bd..937086ea 100644 --- a/bufferevent-internal.h +++ b/bufferevent-internal.h @@ -228,14 +228,14 @@ void _bufferevent_generic_adj_timeouts(struct bufferevent *bev); #define BEV_LOCK(b) do { \ struct bufferevent_private *locking = BEV_UPCAST(b); \ if (locking->lock) \ - EVLOCK_LOCK(locking->lock, EVTHREAD_WRITE); \ + EVLOCK_LOCK(locking->lock, 0); \ } while(0) /** Internal: Release the lock (if any) on a bufferevent */ #define BEV_UNLOCK(b) do { \ struct bufferevent_private *locking = BEV_UPCAST(b); \ if (locking->lock) \ - EVLOCK_UNLOCK(locking->lock, EVTHREAD_WRITE); \ + EVLOCK_UNLOCK(locking->lock, 0); \ } while(0) #ifdef __cplusplus |