Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2014 06:54:10 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263107 - head/lib/libc/gen
Message-ID:  <201403130654.s2D6sAJ6041519@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidxu
Date: Thu Mar 13 06:54:10 2014
New Revision: 263107
URL: http://svnweb.freebsd.org/changeset/base/263107

Log:
  To avoid missing a chance to cancel thread, call _pthread_testcancel at the
  beginning of _sem_timedwait.
  
  Submitted by:	Eric van Gyzen &lt; eric at vangyzen dot net &gt;
  MFC after:	3 days

Modified:
  head/lib/libc/gen/sem_new.c

Modified: head/lib/libc/gen/sem_new.c
==============================================================================
--- head/lib/libc/gen/sem_new.c	Thu Mar 13 05:17:53 2014	(r263106)
+++ head/lib/libc/gen/sem_new.c	Thu Mar 13 06:54:10 2014	(r263107)
@@ -381,6 +381,7 @@ _sem_timedwait(sem_t * __restrict sem,
 		return (-1);
 
 	retval = 0;
+	_pthread_testcancel();
 	for (;;) {
 		while ((val = sem->_kern._count) > 0) {
 			if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1))



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