What is the use of Pthread_join?
Emily Wilson
Updated on May 06, 2026
.
Also to know is, what is the purpose of Pthread_join?
The pthread_join() function suspends execution of the calling thread until the target thread terminates, unless the target thread has already terminated. If status is non-NULL, the value passed to pthread_exit() by the terminated thread is stored in the location pointed to by status.
Similarly, what happens if Pthread_join is not called? After a successful call to pthread_join(), the caller is guaranteed that the target thread has terminated. Joining with a thread that has previously been joined results in undefined behavior. If you don't, then terminating your program will terminate all the unfinished thread abruptly.
Keeping this in consideration, is Pthread_join a blocking call?
pthread_join() is a blocking call, it will block the calling thread until the other thread ends. First parameter of pthread_join() is the ID of target thread.
What is Pthread_create?
The pthread_create() function is used to create a new thread, with attributes specified by attr, within a process. Upon successful completion, pthread_create() stores the ID of the created thread in the location referenced by thread. The thread is created executing start_routine with arg as its sole argument.
Related Question Answers