THRD_JOIN(3C) Standard C Library Functions THRD_JOIN(3C)
NAME
thrd_join - wait for thread termination
SYNOPSIS
#include <threads.h> int thrd_join(
thrd_t thrd,
int *res);
DESCRIPTION
The
thrd_join() function suspends the execution of the current thread
and waits for the thread indicated by
thrd to terminate and stores the
exit status, as set by a call to
thrd_exit(3C), for that thread in
res,
if
res is non-null. The
thrd argument must be a member of the current
process and it cannot be detached. If
thrd has already terminated and
another caller has not called
thrd_join() then the exit status will be
returned to the caller without blocking execution of the thread.
If multiple threads call
thrd_join() on the same thread, then both will
be suspended until that thread terminates; however, only one thread
will return successfully and obtain the actual status and the other
will instead return with an error.
For additional information on the thread joining interfaces supported
by the system, see
pthread_join(3C) and
thr_join(3C).
RETURN VALUES
Upon successful completion, the
thrd_join() function returns
thrd_success and if
res is a non-null pointer, it will be filled in
with the exit status of
thrd. If an error occurs,
thrd_error will be
returned.
INTERFACE STABILITY
StandardMT-LEVEL MT-SafeSEE ALSO
pthread_join(3C),
thrd_create(3C),
thrd_detach(3C),
attributes(7),
threads(7)illumos August 27, 2019 illumos