aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-27 10:32:38 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-27 10:32:38 +0000
commitd2637c70532ba49bf41b25c6aaf1b5d2b09d4aed (patch)
tree055a8b0bf4eb4462552352fbe52793c09f82fdcf /nptl/sysdeps/pthread
parente361e438a115275fdd56eb25a52b798127adae76 (diff)
downloadglibc-d2637c70532ba49bf41b25c6aaf1b5d2b09d4aed.zip
glibc-d2637c70532ba49bf41b25c6aaf1b5d2b09d4aed.tar.gz
glibc-d2637c70532ba49bf41b25c6aaf1b5d2b09d4aed.tar.bz2
Update.
2003-02-24 David Mosberger <davidm@hpl.hp.com> * sysdeps/unix/sysv/linux/ia64/sysdep.S (__syscall_error): Fix unwind info.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_unlock.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_unlock.c b/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
index 6e0c92b..9cae8b6 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
@@ -24,27 +24,32 @@
#include <pthreadP.h>
/* Unlock RWLOCK. */
-int __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
+int
+__pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
{
- lll_mutex_lock(rwlock->__data.__lock);
+ lll_mutex_lock (rwlock->__data.__lock);
if (rwlock->__data.__writer)
rwlock->__data.__writer = 0;
else
- rwlock->__data.__nr_readers--;
- if (!rwlock->__data.__nr_readers)
+ --rwlock->__data.__nr_readers;
+ if (rwlock->__data.__nr_readers == 0)
{
if (rwlock->__data.__nr_writers_queued)
{
++rwlock->__data.__writer_wakeup;
- lll_futex_wake(&rwlock->__data.__writer_wakeup, 1);
+ lll_mutex_unlock (rwlock->__data.__lock);
+ lll_futex_wake (&rwlock->__data.__writer_wakeup, 1);
+ return 0;
}
- else
+ else if (rwlock->__data.__nr_readers_queued)
{
++rwlock->__data.__readers_wakeup;
- lll_futex_wake(&rwlock->__data.__readers_wakeup, INT_MAX);
+ lll_mutex_unlock (rwlock->__data.__lock);
+ lll_futex_wake (&rwlock->__data.__readers_wakeup, INT_MAX);
+ return 0;
}
}
- lll_mutex_unlock(rwlock->__data.__lock);
+ lll_mutex_unlock (rwlock->__data.__lock);
return 0;
}