chsvlib
chsv helper source code

◆ chsv_thrd_join()

int Chusov::ExecutionControl::chsv_thrd_join ( chsv_thrd_t  thr,
int *  res 
)
noexcept

Joins the specified thread to the current one blocking until its completion.

Parameters
[in]thris an identifier of a thread to wait. The thread must not be previously attached or joined.
[out]resis an optional pointer to a buffer, on output receiving a result code of the terminated thread.
Returns
The function returns chsv_thrd_success on success and chsv_thrd_error on failure. In the last case the function also sets the corresponding errno code.

The function joins the thread identified by thr with the current thread by blocking until the other thread has terminated. If the parameter res is not a null pointer, it stores the thread’s result code in the integer pointed to by res.

The termination of the other thread synchronizes with the completion of the chsv_thrd_join function. The thread identified by thr shall not have been previously detached or joined with another thread.

The function implements a behaviour of the thrd_join function defined in the ISO/IEC 9899:2011 (aka C11) standard.

See also
chsv_thrd_create;
chsv_thrd_exit;
chsv_thrd_detach.