Date: Sun, 25 Jan 2026 00:24:48 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c4522efca63f - stable/15 - libthr/thread/thr_join.c: deduplicate backout_join() helper Message-ID: <697562d0.855d.6b2e2a3f@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c4522efca63f6b72a7d7083998f8482feaab83a6 commit c4522efca63f6b72a7d7083998f8482feaab83a6 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-01-18 12:23:14 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-01-25 00:23:35 +0000 libthr/thread/thr_join.c: deduplicate backout_join() helper (cherry picked from commit ce16be73707eedc798b26e0741dcd70d1168ac10) --- lib/libthr/thread/thr_join.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/libthr/thread/thr_join.c b/lib/libthr/thread/thr_join.c index 53f28daa258d..56b316ec0f51 100644 --- a/lib/libthr/thread/thr_join.c +++ b/lib/libthr/thread/thr_join.c @@ -43,16 +43,23 @@ __weak_reference(_thr_join, _pthread_join); __weak_reference(_pthread_timedjoin_np, pthread_timedjoin_np); __weak_reference(_pthread_peekjoin_np, pthread_peekjoin_np); -static void backout_join(void *arg) +static void +backout_join(struct pthread *pthread, struct pthread *curthread) { - struct pthread *pthread = (struct pthread *)arg; - struct pthread *curthread = _get_curthread(); - THR_THREAD_LOCK(curthread, pthread); pthread->joiner = NULL; THR_THREAD_UNLOCK(curthread, pthread); } +static void +backout_join_pop(void *arg) +{ + struct pthread *pthread = (struct pthread *)arg; + struct pthread *curthread = _get_curthread(); + + backout_join(pthread, curthread); +} + int _thr_join(pthread_t pthread, void **thread_return) { @@ -149,10 +156,8 @@ join_common(pthread_t pthread, void **thread_return, _thr_cancel_leave(curthread, 0); THR_CLEANUP_POP(curthread, 0); - if (ret == ETIMEDOUT) { - THR_THREAD_LOCK(curthread, pthread); - pthread->joiner = NULL; - THR_THREAD_UNLOCK(curthread, pthread); + if (ret == ETIMEDOUT || ret == EBUSY) { + backout_join(pthread, curthread); } else { ret = 0; tmp = pthread->ret;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?697562d0.855d.6b2e2a3f>
