aboutsummaryrefslogtreecommitdiff
path: root/nptl/sysdeps/pthread
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-24 09:23:15 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-24 09:23:15 +0000
commit18a535792b7a63721a123e152266c4b8cf1fae8e (patch)
treeb86a475d52a5cade9e9820808a7d8f165cf081aa /nptl/sysdeps/pthread
parent3724f268b15bdbd322cda97f88a965a68f2fd3ef (diff)
downloadglibc-18a535792b7a63721a123e152266c4b8cf1fae8e.zip
glibc-18a535792b7a63721a123e152266c4b8cf1fae8e.tar.gz
glibc-18a535792b7a63721a123e152266c4b8cf1fae8e.tar.bz2
Update.
* sysdeps/pthread/pthread_rwlock_rdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedrdlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_timedwrlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_unlock.c: Likewise. * sysdeps/pthread/pthread_rwlock_wrlock.c: Likewise.
Diffstat (limited to 'nptl/sysdeps/pthread')
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_rdlock.c8
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c9
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c6
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_unlock.c4
-rw-r--r--nptl/sysdeps/pthread/pthread_rwlock_wrlock.c5
5 files changed, 16 insertions, 16 deletions
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c b/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c
index b556ccf..197af9c 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_rdlock.c
@@ -72,18 +72,16 @@ __pthread_rwlock_rdlock (rwlock)
break;
}
+ int waitval = rwlock->__data.__readers_wakeup;
+
/* Free the lock. */
lll_mutex_unlock (rwlock->__data.__lock);
/* Wait for the writer to finish. */
- lll_futex_wait (&rwlock->__data.__readers_wakeup, 0);
+ lll_futex_wait (&rwlock->__data.__readers_wakeup, waitval);
/* Get the lock. */
lll_mutex_lock (rwlock->__data.__lock);
-
- /* To start over again, remove the thread from the reader list. */
- if (--rwlock->__data.__nr_readers_queued == 0)
- rwlock->__data.__readers_wakeup = 0;
}
/* We are done, free the lock. */
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c b/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
index 4f7b78d..fb63825 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_timedrdlock.c
@@ -105,19 +105,18 @@ pthread_rwlock_timedrdlock (rwlock, abstime)
break;
}
+ int waitval = rwlock->__data.__readers_wakeup;
+
/* Free the lock. */
lll_mutex_unlock (rwlock->__data.__lock);
/* Wait for the writer to finish. */
- result = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup, 0, &rt);
+ result = lll_futex_timed_wait (&rwlock->__data.__readers_wakeup,
+ waitval, &rt);
/* Get the lock. */
lll_mutex_lock (rwlock->__data.__lock);
- /* To start over again, remove the thread from the reader list. */
- if (--rwlock->__data.__nr_readers_queued == 0)
- rwlock->__data.__readers_wakeup = 0;
-
/* Did the futex call time out? */
if (result == -ETIMEDOUT)
{
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c b/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
index 4c0dc38..0715f83 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
@@ -95,18 +95,20 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
break;
}
+ int waitval = rwlock->__data.__writer_wakeup;
+
/* Free the lock. */
lll_mutex_unlock (rwlock->__data.__lock);
/* Wait for the writer or reader(s) to finish. */
- result = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup, 0, &rt);
+ result = lll_futex_timed_wait (&rwlock->__data.__writer_wakeup,
+ waitval, &rt);
/* Get the lock. */
lll_mutex_lock (rwlock->__data.__lock);
/* To start over again, remove the thread from the writer list. */
--rwlock->__data.__nr_writers_queued;
- rwlock->__data.__writer_wakeup = 0;
/* Did the futex call time out? */
if (result == -ETIMEDOUT)
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_unlock.c b/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
index 325007e..6e0c92b 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_unlock.c
@@ -35,12 +35,12 @@ int __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
{
if (rwlock->__data.__nr_writers_queued)
{
- rwlock->__data.__writer_wakeup = 1;
+ ++rwlock->__data.__writer_wakeup;
lll_futex_wake(&rwlock->__data.__writer_wakeup, 1);
}
else
{
- rwlock->__data.__readers_wakeup = 1;
+ ++rwlock->__data.__readers_wakeup;
lll_futex_wake(&rwlock->__data.__readers_wakeup, INT_MAX);
}
}
diff --git a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
index 024b671..03c37a1 100644
--- a/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
+++ b/nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
@@ -63,18 +63,19 @@ __pthread_rwlock_wrlock (rwlock)
break;
}
+ int waitval = rwlock->__data.__writer_wakeup;
+
/* Free the lock. */
lll_mutex_unlock (rwlock->__data.__lock);
/* Wait for the writer or reader(s) to finish. */
- lll_futex_wait (&rwlock->__data.__writer_wakeup, 0);
+ lll_futex_wait (&rwlock->__data.__writer_wakeup, waitval);
/* Get the lock. */
lll_mutex_lock (rwlock->__data.__lock);
/* To start over again, remove the thread from the writer list. */
--rwlock->__data.__nr_writers_queued;
- rwlock->__data.__writer_wakeup = 0;
}
/* We are done, free the lock. */