From 8dad4589a874ed1c832c9c4aa0ac59a53fe24e8c Mon Sep 17 00:00:00 2001 From: jasone Date: Sun, 14 May 2017 17:10:55 +0000 Subject: [PATCH] MFC r318254: Fix __pthread_mutex_trylock() to call THR_CRITICAL_LEAVE() on failure rather than on success. This regression was introduced by r300043 (Add implementation of robust mutexes...). --- lib/libthr/thread/thr_mutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index da53c851e51..877bd37fe88 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -631,7 +631,7 @@ __pthread_mutex_trylock(pthread_mutex_t *mutex) } /* else {} */ if (robust) _mutex_leave_robust(curthread, m); - if ((ret == 0 || ret == EOWNERDEAD) && + if (ret != 0 && ret != EOWNERDEAD && (m->m_flags & PMUTEX_FLAG_PRIVATE) != 0) THR_CRITICAL_LEAVE(curthread); return (ret); -- 2.45.0