Index: pthread_mutex.c =================================================================== RCS file: /cvsroot/src/lib/libpthread/pthread_mutex.c,v retrieving revision 1.62 diff -u -u -r1.62 pthread_mutex.c --- pthread_mutex.c 17 Jul 2016 13:49:43 -0000 1.62 +++ pthread_mutex.c 31 Oct 2016 19:09:48 -0000 @@ -298,7 +298,8 @@ * we see that the holder is running again. */ membar_sync(); - pthread__mutex_spin(ptm, owner); + if (MUTEX_OWNER(owner) != (uintptr_t)self) + pthread__mutex_spin(ptm, owner); if (membar_consumer(), !MUTEX_HAS_WAITERS(ptm->ptm_owner)) { goto again; @@ -338,7 +339,8 @@ serrno = errno; for (;; owner = ptm->ptm_owner) { /* Spin while the owner is running. */ - owner = pthread__mutex_spin(ptm, owner); + if (MUTEX_OWNER(owner) != (uintptr_t)self) + owner = pthread__mutex_spin(ptm, owner); /* If it has become free, try to acquire it again. */ if (MUTEX_OWNER(owner) == 0) {