thrd_join(3) Library Functions Manual thrd_join(3) NAME thrd_join – detach thread SYNOPSIS library “threads” #include int thrd_join(thrd_t thrd, int *res); DESCRIPTION The function thrd_join() will suspend the execution of the current thread and will wait for the given thread thrd to finish executing. The exit status of the given thread as set by thrd_exit(3) can then be retrieved by the res argument if it is not NULL. The given thread must not have been detached by thrd_detach(3) and must be a member of the current process. If the given thread has already been terminated and thrd_join() has not yet been called for the given thread before, the exit status can be retrieved without the function blocking. If multiple threads call thrd_join() for the same thread they all will wait for execution of the given thread, however only one of the threads will retrieve the exit status. RETURN VALUES The function thrd_join() returns thrd_success on success. If the res argument is not NULL it will populate the integer pointed to by the argument with the exit status of the joining thread. In case of an error thrd_error if an error has occurred. SEE ALSO thrd_create(3) thrd_exit(3) thrd_yield(3) thrd_equal(3) thrd_detach(3) thrd_current(3) thrd_sleep(3) HISTORY The thrd_join() function first appeared in the C11 standard ISO/IEC 9899:2011. AUTHORS Jan Adelsbach Debian May 9, 2020 Debian