Document pthread_tryjoin_np(3)

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D54766
This commit is contained in:
Konstantin Belousov
2026-01-18 14:53:12 +02:00
parent afa70a8496
commit 7f026a5869
2 changed files with 25 additions and 4 deletions
+2 -1
View File
@@ -540,6 +540,7 @@ PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \
PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \ PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \
pthread_testcancel.3 pthread_setcanceltype.3 pthread_testcancel.3 pthread_setcanceltype.3
PTHREAD_MLINKS+=pthread_join.3 pthread_peekjoin_np.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> .include <bsd.prog.mk>
+23 -3
View File
@@ -35,6 +35,7 @@
.Nm pthread_join , .Nm pthread_join ,
.Nm pthread_peekjoin_np , .Nm pthread_peekjoin_np ,
.Nm pthread_timedjoin_np .Nm pthread_timedjoin_np
.Nm pthread_tryjoin_np
.Nd inspect thread termination state .Nd inspect thread termination state
.Sh LIBRARY .Sh LIBRARY
.Lb libpthread .Lb libpthread
@@ -54,6 +55,8 @@
.Fa "void **value_ptr" .Fa "void **value_ptr"
.Fa "const struct timespec *abstime" .Fa "const struct timespec *abstime"
.Fc .Fc
.Ft int
.Fn pthread_tryjoin_np "pthread_t thread" "void **value_ptr"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn pthread_join .Fn pthread_join
@@ -104,6 +107,13 @@ the
.Fn pthread_join .Fn pthread_join
family of functions again. family of functions again.
.Pp .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 A thread that has exited but remains unjoined counts against
[_POSIX_THREAD_THREADS_MAX]. [_POSIX_THREAD_THREADS_MAX].
.Sh RETURN VALUES .Sh RETURN VALUES
@@ -147,7 +157,9 @@ waited for thread exit.
.Pp .Pp
The The
.Fn pthread_peekjoin_np .Fn pthread_peekjoin_np
function will also fail if: and
.Fn pthread_tryjoin_np
functions will also fail if:
.Bl -tag -width Er .Bl -tag -width Er
.It Bq Er EBUSY .It Bq Er EBUSY
The specified thread has not yet exited. The specified thread has not yet exited.
@@ -168,7 +180,15 @@ function is a
.Fx .Fx
extension which first appeared in extension which first appeared in
.Fx 6.1 . .Fx 6.1 .
Another extension, the The
.Fn pthread_peekjoin_np .Fn pthread_peekjoin_np
function, first appearead in function is a
.Fx
extension which first appearead in
.Fx 13.0 . .Fx 13.0 .
The
.Fn pthread_tryjoin_np
function is a
.Fx
extension which first appearead in
.Fx 16.0 .