Index: libpthread/sysdeps/generic/pt-mutex-timedlock.c =================================================================== RCS file: /sources/hurd/hurd-l4/libpthread/sysdeps/generic/pt-mutex-timedlock.c,v retrieving revision 1.4 diff -u -p -r1.4 pt-mutex-timedlock.c --- libpthread/sysdeps/generic/pt-mutex-timedlock.c 22 Jun 2008 08:58:20 -0000 1.4 +++ libpthread/sysdeps/generic/pt-mutex-timedlock.c 1 Oct 2008 10:37:20 -0000 @@ -36,6 +36,7 @@ __pthread_mutex_timedlock_internal (stru if (__pthread_spin_trylock (&mutex->__held) == 0) /* Successfully acquired the lock. */ { +#ifdef ALWAYS_TRACK_OWNER #ifndef NDEBUG self = _pthread_self (); if (self) @@ -47,6 +48,7 @@ __pthread_mutex_timedlock_internal (stru mutex->owner = _pthread_self (); } #endif +#endif if (mutex->attr) switch (mutex->attr->mutex_type) @@ -73,14 +75,16 @@ __pthread_mutex_timedlock_internal (stru self = _pthread_self (); assert (self); - if (mutex->attr) + if (! mutex->attr || mutex->attr->mutex_type == PTHREAD_MUTEX_NORMAL) + { +#if defined(ALWAYS_TRACK_MUTEX_OWNER) + assert (mutex->owner != self); +#endif + } + else { switch (mutex->attr->mutex_type) { - case PTHREAD_MUTEX_NORMAL: - assert (mutex->owner != self); - break; - case PTHREAD_MUTEX_ERRORCHECK: if (mutex->owner == self) { @@ -102,10 +106,11 @@ __pthread_mutex_timedlock_internal (stru LOSE; } } - else - assert (mutex->owner != self); - assert (mutex->owner); +#if !defined(ALWAYS_TRACK_MUTEX_OWNER) + if (mutex->attr && mutex->attr->mutex_type != PTHREAD_MUTEX_NORMAL) +#endif + assert (mutex->owner); if (abstime && (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)) return EINVAL; @@ -141,9 +146,12 @@ __pthread_mutex_timedlock_internal (stru else __pthread_block (self); -#ifndef NDEBUG - assert (mutex->owner == self); +#if !defined(ALWAYS_TRACK_MUTEX_OWNER) + if (mutex->attr && mutex->attr->mutex_type != PTHREAD_MUTEX_NORMAL) #endif + { + assert (mutex->owner == self); + } if (mutex->attr) switch (mutex->attr->mutex_type) Index: libpthread/sysdeps/generic/pt-mutex-transfer-np.c =================================================================== RCS file: /sources/hurd/hurd-l4/libpthread/sysdeps/generic/pt-mutex-transfer-np.c,v retrieving revision 1.1 diff -u -p -r1.1 pt-mutex-transfer-np.c --- libpthread/sysdeps/generic/pt-mutex-transfer-np.c 1 Mar 2008 13:07:22 -0000 1.1 +++ libpthread/sysdeps/generic/pt-mutex-transfer-np.c 1 Oct 2008 10:37:20 -0000 @@ -45,7 +45,12 @@ __pthread_mutex_transfer_np (struct __pt } #ifndef NDEBUG - mutex->owner = thread; +# if !defined(ALWAYS_TRACK_MUTEX_OWNER) + if (mutex->attr && mutex->attr->mutex_type != PTHREAD_MUTEX_NORMAL) +# endif + { + mutex->owner = thread; + } #endif return 0; Index: libpthread/sysdeps/generic/pt-mutex-unlock.c =================================================================== RCS file: /sources/hurd/hurd-l4/libpthread/sysdeps/generic/pt-mutex-unlock.c,v retrieving revision 1.5 diff -u -p -r1.5 pt-mutex-unlock.c --- libpthread/sysdeps/generic/pt-mutex-unlock.c 22 Jun 2008 09:16:45 -0000 1.5 +++ libpthread/sysdeps/generic/pt-mutex-unlock.c 1 Oct 2008 10:37:20 -0000 @@ -33,7 +33,8 @@ __pthread_mutex_unlock (pthread_mutex_t 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); @@ -45,6 +46,7 @@ __pthread_mutex_unlock (pthread_mutex_t _pthread_self ()->threadid); mutex->owner = NULL; } +# endif #endif } else @@ -84,7 +86,12 @@ __pthread_mutex_unlock (pthread_mutex_t __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