Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 May 2016 06:53:22 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r299521 - stable/10/lib/libthr/thread
Message-ID:  <201605120653.u4C6rMK2095536@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu May 12 06:53:22 2016
New Revision: 299521
URL: https://svnweb.freebsd.org/changeset/base/299521

Log:
  MFC r299114:
  Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resume
  cycle.
  
  PR:	209233

Modified:
  stable/10/lib/libthr/thread/thr_resume_np.c
  stable/10/lib/libthr/thread/thr_sig.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libthr/thread/thr_resume_np.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_resume_np.c	Thu May 12 06:39:13 2016	(r299520)
+++ stable/10/lib/libthr/thread/thr_resume_np.c	Thu May 12 06:53:22 2016	(r299521)
@@ -90,7 +90,7 @@ static void
 resume_common(struct pthread *thread)
 {
 	/* Clear the suspend flag: */
-	thread->flags &= ~THR_FLAGS_NEED_SUSPEND;
+	thread->flags &= ~(THR_FLAGS_NEED_SUSPEND | THR_FLAGS_SUSPENDED);
 	thread->cycle++;
 	_thr_umtx_wake(&thread->cycle, 1, 0);
 }

Modified: stable/10/lib/libthr/thread/thr_sig.c
==============================================================================
--- stable/10/lib/libthr/thread/thr_sig.c	Thu May 12 06:39:13 2016	(r299520)
+++ stable/10/lib/libthr/thread/thr_sig.c	Thu May 12 06:53:22 2016	(r299521)
@@ -373,8 +373,7 @@ check_suspend(struct pthread *curthread)
 	 */
 	curthread->critical_count++;
 	THR_UMUTEX_LOCK(curthread, &(curthread)->lock);
-	while ((curthread->flags & (THR_FLAGS_NEED_SUSPEND |
-		THR_FLAGS_SUSPENDED)) == THR_FLAGS_NEED_SUSPEND) {
+	while ((curthread->flags & THR_FLAGS_NEED_SUSPEND) != 0) {
 		curthread->cycle++;
 		cycle = curthread->cycle;
 
@@ -391,7 +390,6 @@ check_suspend(struct pthread *curthread)
 		THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock);
 		_thr_umtx_wait_uint(&curthread->cycle, cycle, NULL, 0);
 		THR_UMUTEX_LOCK(curthread, &(curthread)->lock);
-		curthread->flags &= ~THR_FLAGS_SUSPENDED;
 	}
 	THR_UMUTEX_UNLOCK(curthread, &(curthread)->lock);
 	curthread->critical_count--;



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