summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-05-12 06:53:22 +0000
committerkib <kib@FreeBSD.org>2016-05-12 06:53:22 +0000
commit4f8ce4509a035d7c39c6f848b47b7bdc17ebe1ed (patch)
tree9bf664a17d03eeee6cd43545eec683306025bfc2 /lib
parentbd88c5334ca14635998cac65b7083ed3c1065c71 (diff)
downloadFreeBSD-src-4f8ce4509a035d7c39c6f848b47b7bdc17ebe1ed.zip
FreeBSD-src-4f8ce4509a035d7c39c6f848b47b7bdc17ebe1ed.tar.gz
MFC r299114:
Do not leak THR_FLAGS_SUSPENDED from the previous suspend/resume cycle. PR: 209233
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_resume_np.c2
-rw-r--r--lib/libthr/thread/thr_sig.c4
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c
index 53377da..212d1c8 100644
--- a/lib/libthr/thread/thr_resume_np.c
+++ b/lib/libthr/thread/thr_resume_np.c
@@ -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);
}
diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c
index ebb6c58..dc51f34 100644
--- a/lib/libthr/thread/thr_sig.c
+++ b/lib/libthr/thread/thr_sig.c
@@ -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--;
OpenPOWER on IntegriCloud