summaryrefslogtreecommitdiff
path: root/sysdeps/generic/pt-mutex-unlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/pt-mutex-unlock.c')
-rw-r--r--sysdeps/generic/pt-mutex-unlock.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/generic/pt-mutex-unlock.c b/sysdeps/generic/pt-mutex-unlock.c
index 492dfcb5..7645fd4c 100644
--- a/sysdeps/generic/pt-mutex-unlock.c
+++ b/sysdeps/generic/pt-mutex-unlock.c
@@ -33,13 +33,15 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex)
if (! mutex->attr || mutex->attr->mutex_type == PTHREAD_MUTEX_NORMAL)
{
-#ifndef NDEBUG
+#if defined(ALWAYS_TRACK_MUTEX_OWNER)
+# ifndef NDEBUG
if (_pthread_self ())
{
assert (mutex->owner);
assert (mutex->owner == _pthread_self ());
mutex->owner = NULL;
}
+# endif
#endif
}
else
@@ -79,7 +81,12 @@ __pthread_mutex_unlock (pthread_mutex_t *mutex)
__pthread_dequeue (wakeup);
#ifndef NDEBUG
- mutex->owner = wakeup;
+# if !defined (ALWAYS_TRACK_MUTEX_OWNER)
+ if (mutex->attr && mutex->attr->mutex_type != PTHREAD_MUTEX_NORMAL)
+# endif
+ {
+ mutex->owner = wakeup;
+ }
#endif
/* We do not unlock MUTEX->held: we are transferring the ownership