thrd_join Subroutine
Purpose
This subroutine joins the thread that is identified by the thr parameter and updates the res parameter with the results.
Library
Standard C Library (libc.a)
Syntax
#include <threads.h>
int thrd_join(thrd_t thr, int *res);
Description
The thrd_join subroutine joins the thread that is identified by the thr parameter with the current thread by blocking until the other thread is stopped. If the res parameter is not a null pointer, it stores the thread’s result code in the integer specified by the res parameter. The ending of the other thread is synchronized with the completion of the thrd_join subroutine. The thread that is identified by the thr parameter is not previously detached or joined with another thread.
Parameters
Item | Description |
---|---|
thr |
Specifies the thread that must be joined with the current thread. |
res |
Holds the thread's result code if the value specified is not a null pointer. |
Return Values
The thrd_join subroutine returns thrd_successon successful completion or it returns thrd_error if the request is not completed.
Files
Item | Description |
---|---|
threads.h | Standard macros, data types, and subroutines are defined by the threads.h file. |