summaryrefslogtreecommitdiff
path: root/mysys/thr_rwlock.c
diff options
context:
space:
mode:
authormonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
committermonty@donna.mysql.com <>2000-08-15 20:09:37 +0300
commitea013c2152301e459504451efdb17f4c9bb30877 (patch)
tree5f72e7444fbc3c8d944a66b54b26550a04e4f0be /mysys/thr_rwlock.c
parent807460bbceceec25bf97352bc5e232c3e766d70f (diff)
downloadmariadb-git-ea013c2152301e459504451efdb17f4c9bb30877.tar.gz
Fixed for Ia64 + delayed key creation + a lot of small bug fixes
Diffstat (limited to 'mysys/thr_rwlock.c')
-rw-r--r--mysys/thr_rwlock.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index fc2eea551da..37630956e7f 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -87,7 +87,7 @@ int my_rw_rdlock( rw_lock_t *rwp ) {
pthread_mutex_lock(&rwp->lock);
/* active or queued writers */
- while ( ( rwp->state < 0 ) && rwp->waiters )
+ while ( ( rwp->state < 0 ) || rwp->waiters )
pthread_cond_wait( &rwp->readers, &rwp->lock);
rwp->state++;
@@ -103,12 +103,8 @@ int my_rw_wrlock( rw_lock_t *rwp ) {
while ( rwp->state )
pthread_cond_wait( &rwp->writers, &rwp->lock);
-
rwp->state = -1;
-
- if ( ( --rwp->waiters == 0 ) && ( rwp->state >= 0 ) )
- pthread_cond_broadcast( &rwp->readers );
-
+ --rwp->waiters;
pthread_mutex_unlock( &rwp->lock );
return( 0 );