pthreadjoin
pthread_join is a function in the POSIX threads (pthreads) API that allows one thread to wait for another to finish and to obtain the terminating status of that thread. It is used to synchronize thread completion and to reclaim resources associated with a thread.
Signature and parameters: int pthread_join(pthread_t thread, void retval); The thread parameter specifies the target thread to
Behavior: The calling thread blocks until the specified thread terminates. Upon successful completion, the resources of
Return values and errors: The function returns 0 on success. On error, it returns an error number,
Usage considerations: A thread must be joinable to be joined. Do not attempt to join a thread