pthread_exit - thread termination
pthread_join - join at
termination
pthread_detach - recovers memory from exiting thread
#include <pthread.h>
pthread_exit() terminates the calling thread. The pointer
status is passed to the joining thread as a pointer to a
pointer.
pthread_join() waits for the other thread and when
it terminates it receives a pointer to a message which may be null in
which case no message is passed. Multiple calls to pthread_join() by a
collection of threads is undefined behavior.
pthread_detach()
is typically used with pthread_join() to recover memory that
the thread may not have released.
pthread_exit() does not returns to its caller.
pthread_join() returns zero if successful or an error number.
pthread_detach() returns zero if successful or an error number.
pthread_join() fails with the following errors if:
pthread_detach() fails with the following errors if: