thr_join() returns 0 if successful. When any of the following conditions is detected, thr_join() fails and returns the corresponding value.
ESRCH
Description:No undetached thread is found which corresponds to the target thread ID.
EDEADLK
Description:A deadlock was detected or the value of the target thread specifies the calling thread.