summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-06-22 08:58:20 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-07 23:17:47 +0200
commit6f18deca8f1d582f2d870c1431a83d1e47a3eac2 (patch)
tree3551f6e9cdf150446dcf5bd068859d862735064c /sysdeps
parent087d4b47215d95828863334b96edaad262ff6d02 (diff)
2008-06-22 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Don't set MUTEX->OWNER here. * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Set it here to WAKEUP.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/pt-mutex-timedlock.c11
-rw-r--r--sysdeps/generic/pt-mutex-unlock.c4
2 files changed, 10 insertions, 5 deletions
diff --git a/sysdeps/generic/pt-mutex-timedlock.c b/sysdeps/generic/pt-mutex-timedlock.c
index 6db30c5d..265a4530 100644
--- a/sysdeps/generic/pt-mutex-timedlock.c
+++ b/sysdeps/generic/pt-mutex-timedlock.c
@@ -141,15 +141,16 @@ __pthread_mutex_timedlock_internal (struct __pthread_mutex *mutex,
else
__pthread_block (self);
- if (! mutex->attr || mutex->attr->mutex_type == PTHREAD_MUTEX_NORMAL)
- {
#ifndef NDEBUG
- mutex->owner = self;
+ assert (mutex->owner == self);
#endif
- }
- else
+
+ if (mutex->attr)
switch (mutex->attr->mutex_type)
{
+ case PTHREAD_MUTEX_NORMAL:
+ break;
+
case PTHREAD_MUTEX_RECURSIVE:
assert (mutex->locks == 0);
mutex->locks = 1;
diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c
index a9872252..492dfcb5 100644
--- a/sysdeps/generic/pt-mutex-unlock.c
+++ b/sysdeps/generic/pt-mutex-unlock.c
@@ -78,6 +78,10 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex)
wakeup = mutex->__queue;
__pthread_dequeue (wakeup);
+#ifndef NDEBUG
+ mutex->owner = wakeup;
+#endif
+
/* We do not unlock MUTEX->held: we are transferring the ownership
to the thread that we are waking up. */