diff options
author | Sergei Golubchik <serg@mysql.com> | 2008-10-24 12:34:08 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mysql.com> | 2008-10-24 12:34:08 +0200 |
commit | 14c146618707540c46e1ab1c8b8f103913e1237a (patch) | |
tree | 3d3e78ed586e4e58b2171a1e72ab81c51eec99d1 /mysys/thr_rwlock.c | |
parent | 9fb894540ed937e1caf8109f356219c103a2c9d1 (diff) | |
download | mariadb-git-14c146618707540c46e1ab1c8b8f103913e1237a.tar.gz |
wt needs to use its own implementation of rwlocks with
reader preference, at least where system rwlocks are fair.
include/my_global.h:
wt uses mutex-based rwlock implementation unless on linux
include/waiting_threads.h:
mutex-based rwlock implementation with reader preference
mysys/thr_rwlock.c:
revert the change. make my_rw_locks fair
mysys/waiting_threads.c:
mutex-based rwlock implementation with reader preference.
convert complex multi-line macros to static functions
Diffstat (limited to 'mysys/thr_rwlock.c')
-rw-r--r-- | mysys/thr_rwlock.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c index 2a249cbf850..280a0ec19e7 100644 --- a/mysys/thr_rwlock.c +++ b/mysys/thr_rwlock.c @@ -89,7 +89,7 @@ int my_rw_rdlock(rw_lock_t *rwp) pthread_mutex_lock(&rwp->lock); /* active or queued writers */ - while (( rwp->state < 0 )) + while ((rwp->state < 0 ) || rwp->waiters) pthread_cond_wait( &rwp->readers, &rwp->lock); rwp->state++; @@ -101,7 +101,7 @@ int my_rw_tryrdlock(rw_lock_t *rwp) { int res; pthread_mutex_lock(&rwp->lock); - if ((rwp->state < 0 )) + if ((rwp->state < 0 ) || rwp->waiters) res= EBUSY; /* Can't get lock */ else { |