thrd_join()

Join thread

Synopsis:

#include <threads.h>

int thrd_join( thrd_t thr,
               int *const res );

Arguments:

thr
The target thread whose termination you're waiting for.
res
NULL, or a pointer to a location where the function can store the value passed to thrd_exit() by the target thread.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The thrd_join() function blocks the calling thread until the target thread thr terminates, unless thr has already terminated. If res is non-NULL and thrd_join() returns successfully, then the value passed to thrd_exit() by the target thread is placed in res.

The target thread must be joinable. Multiple thrd_join(), pthread_join(), pthread_timedjoin(), ThreadJoin(), and ThreadJoin_r() calls on the same target thread aren't allowed. When thrd_join() returns successfully, the target thread has been terminated.

Returns:

thrd_success
Success.
thrd_error
An error occurred.

Classification:

C11

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes