The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f026a58691db1763203ab8c7c8f34f738bfd9d5
commit 7f026a58691db1763203ab8c7c8f34f738bfd9d5 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-01-18 12:53:12 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-01-19 16:50:02 +0000 Document pthread_tryjoin_np(3) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54766 --- share/man/man3/Makefile | 3 ++- share/man/man3/pthread_join.3 | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 8e4aadc460a6..cae79b8f8182 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -540,6 +540,7 @@ PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \ PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \ pthread_testcancel.3 pthread_setcanceltype.3 PTHREAD_MLINKS+=pthread_join.3 pthread_peekjoin_np.3 \ - pthread_join.3 pthread_timedjoin_np.3 + pthread_join.3 pthread_timedjoin_np.3 \ + pthread_join.3 pthread_tryjoin_np.3 .include <bsd.prog.mk> diff --git a/share/man/man3/pthread_join.3 b/share/man/man3/pthread_join.3 index 716b171e1295..671ce7bb445c 100644 --- a/share/man/man3/pthread_join.3 +++ b/share/man/man3/pthread_join.3 @@ -35,6 +35,7 @@ .Nm pthread_join , .Nm pthread_peekjoin_np , .Nm pthread_timedjoin_np +.Nm pthread_tryjoin_np .Nd inspect thread termination state .Sh LIBRARY .Lb libpthread @@ -54,6 +55,8 @@ .Fa "void **value_ptr" .Fa "const struct timespec *abstime" .Fc +.Ft int +.Fn pthread_tryjoin_np "pthread_t thread" "void **value_ptr" .Sh DESCRIPTION The .Fn pthread_join @@ -104,6 +107,13 @@ the .Fn pthread_join family of functions again. .Pp +The +.Fn pthread_tryjoin_np +function joins the thread if it is already terminated, same as +.Fn pthread_join . +If the thread has not yet terminated, the function returns +.Er EBUSY . +.Pp A thread that has exited but remains unjoined counts against [_POSIX_THREAD_THREADS_MAX]. .Sh RETURN VALUES @@ -147,7 +157,9 @@ waited for thread exit. .Pp The .Fn pthread_peekjoin_np -function will also fail if: +and +.Fn pthread_tryjoin_np +functions will also fail if: .Bl -tag -width Er .It Bq Er EBUSY The specified thread has not yet exited. @@ -168,7 +180,15 @@ function is a .Fx extension which first appeared in .Fx 6.1 . -Another extension, the +The .Fn pthread_peekjoin_np -function, first appearead in +function is a +.Fx +extension which first appearead in .Fx 13.0 . +The +.Fn pthread_tryjoin_np +function is a +.Fx +extension which first appearead in +.Fx 16.0 .
