diff options
author | kib <kib@FreeBSD.org> | 2016-12-13 09:43:49 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-12-13 09:43:49 +0000 |
commit | ca7cc4c0b0dce0fbfd12ffbaefd066b7e949b135 (patch) | |
tree | 3353d8e715919a6185fa9354b0f066e6603cdd5e /lib/libthr/thread | |
parent | 0a0bda82615be0207814d7a2c02873ec5ecedce8 (diff) | |
download | FreeBSD-src-ca7cc4c0b0dce0fbfd12ffbaefd066b7e949b135.zip FreeBSD-src-ca7cc4c0b0dce0fbfd12ffbaefd066b7e949b135.tar.gz |
MFC r309630:
Do not leak curthread->inact_mtx when cancelling in pthread_cond_wait(3).
Diffstat (limited to 'lib/libthr/thread')
-rw-r--r-- | lib/libthr/thread/thr_cond.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c index 506b8ec..64d075c 100644 --- a/lib/libthr/thread/thr_cond.c +++ b/lib/libthr/thread/thr_cond.c @@ -224,16 +224,26 @@ cond_wait_kernel(struct pthread_cond *cvp, struct pthread_mutex *mp, * state and unlock the mutex without making the state * consistent and the state will be unrecoverable. */ - if (error2 == 0 && cancel) + if (error2 == 0 && cancel) { + if (robust) { + _mutex_leave_robust(curthread, mp); + robust = false; + } _thr_testcancel(curthread); + } if (error == EINTR) error = 0; } else { /* We know that it didn't unlock the mutex. */ _mutex_cv_attach(mp, recurse); - if (cancel) + if (cancel) { + if (robust) { + _mutex_leave_robust(curthread, mp); + robust = false; + } _thr_testcancel(curthread); + } error2 = 0; } if (robust) |