aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-01-18 12:53:12 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-01-25 00:23:35 +0000
commitd1ac644ccc43148525371d099ebbcb0fe4a471d0 (patch)
tree06f9773d7a39940cd796cbbc2853e83a8ad39cd8
parenta8891c29d6a0a9a8ed32148332b890941e86a766 (diff)
Document pthread_tryjoin_np(3)
(cherry picked from commit 7f026a58691db1763203ab8c7c8f34f738bfd9d5)
-rw-r--r--share/man/man3/Makefile3
-rw-r--r--share/man/man3/pthread_join.326
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 .