Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 May 2017 17:49:53 +0000 (UTC)
From:      Jason Evans <jasone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318254 - head/lib/libthr/thread
Message-ID:  <201705131749.v4DHnrTE057219@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705131749.v4DHnrTE057219>