diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/pt-mutex-timedlock.c | 11 | ||||
-rw-r--r-- | sysdeps/generic/pt-mutex-unlock.c | 4 |
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. */ |