diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-01-01 17:42:41 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-04-07 23:11:53 +0200 |
commit | 00905beb9fabe556ae905b5eaa14e8c76dff7d79 (patch) | |
tree | 1f1f2349dd65fe62a938f9bf9b725131b3875d43 /sysdeps/generic/pt-mutex-unlock.c | |
parent | 580da795e84996d81b3db9ef1878d8569a4b9530 (diff) |
2008-01-01 Neal H. Walfield <neal@gnu.org>
* sysdeps/generic/pt-mutex-timedlock.c
(__pthread_mutex_timedlock_internal): Add additional asserts.
[! NDEBUG]: Keep MUTEX->OWNER up to date.
* sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock):
Add additional asserts.
[! NDEBUG]: Keep MUTEX->OWNER up to date.
* sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Add
additional asserts.
[! NDEBUG]: Keep MUTEX->OWNER up to date.
Diffstat (limited to 'sysdeps/generic/pt-mutex-unlock.c')
-rw-r--r-- | sysdeps/generic/pt-mutex-unlock.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c index 2f719d3..a987225 100644 --- a/sysdeps/generic/pt-mutex-unlock.c +++ b/sysdeps/generic/pt-mutex-unlock.c @@ -1,5 +1,5 @@ /* Unlock a mutex. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,12 +31,20 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) __pthread_spin_lock (&mutex->__lock); - if (mutex->attr) + if (! mutex->attr || mutex->attr->mutex_type == PTHREAD_MUTEX_NORMAL) + { +#ifndef NDEBUG + if (_pthread_self ()) + { + assert (mutex->owner); + assert (mutex->owner == _pthread_self ()); + mutex->owner = NULL; + } +#endif + } + else switch (mutex->attr->mutex_type) { - case PTHREAD_MUTEX_NORMAL: - break; - case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_RECURSIVE: if (mutex->owner != _pthread_self ()) @@ -59,6 +67,7 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex) LOSE; } + if (mutex->__queue == NULL) { __pthread_spin_unlock (&mutex->__held); |