svn commit: r318254 - head/lib/libthr/thread

Jason Evans jasone at FreeBSD.org
Sat May 13 17:49:54 UTC 2017


Author: jasone
Date: Sat May 13 17:49:53 2017
New Revision: 318254
URL: https://svnweb.freebsd.org/changeset/base/318254

Log:
  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...).
  
  MFC after:	1 day

Modified:
  head/lib/libthr/thread/thr_mutex.c

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Sat May 13 13:03:20 2017	(r318253)
+++ head/lib/libthr/thread/thr_mutex.c	Sat May 13 17:49:53 2017	(r318254)
@@ -631,7 +631,7 @@ __pthread_mutex_trylock(pthread_mutex_t 
 	} /* 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);


More information about the svn-src-head mailing list