diff options
author | neal <neal> | 2008-06-22 08:58:20 +0000 |
---|---|---|
committer | neal <neal> | 2008-06-22 08:58:20 +0000 |
commit | 25f5fdaa9e28b4e768bc5c28435b3275bb60d886 (patch) | |
tree | f322d16138ca918a50860f84b18703d8f22bdfdd /libpthread | |
parent | 9929decf0860291ea6f7d5fc2eb1ed024edf0afa (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 'libpthread')
-rw-r--r-- | libpthread/ChangeLog | 7 | ||||
-rw-r--r-- | libpthread/sysdeps/generic/pt-mutex-timedlock.c | 11 | ||||
-rw-r--r-- | libpthread/sysdeps/generic/pt-mutex-unlock.c | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/libpthread/ChangeLog b/libpthread/ChangeLog index 9b0628b..b8a3b18 100644 --- a/libpthread/ChangeLog +++ b/libpthread/ChangeLog @@ -1,3 +1,10 @@ +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. + 2008-06-07 Neal H. Walfield <neal@gnu.org> * pthread/pt-internal.h (__pthread_queue_iterate): Use 1, not diff --git a/libpthread/sysdeps/generic/pt-mutex-timedlock.c b/libpthread/sysdeps/generic/pt-mutex-timedlock.c index 6db30c5..265a453 100644 --- a/libpthread/sysdeps/generic/pt-mutex-timedlock.c +++ b/libpthread/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/libpthread/sysdeps/generic/pt-mutex-unlock.c b/libpthread/sysdeps/generic/pt-mutex-unlock.c index a987225..492dfcb 100644 --- a/libpthread/sysdeps/generic/pt-mutex-unlock.c +++ b/libpthread/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. */ |