To explicitly create a thread as joinable or detached, the
attr
argument in the
pthread_create()
routine is used. The typical 4 step process is:
- Declare a pthread attribute variable of the pthread_attr_t data type
- Initialize the attribute variable with pthread_attr_init()
- Set the attribute detached status with pthread_attr_setdetachstate()
- When done, free library resources used by the attribute with pthread_attr_destroy()
/**
* NAME
* pthread_join - wait for thread termination
* SYNOPSIS
* #include <pthread.h>
* int pthread_join(pthread_t thread, void **value_ptr);
* DESCRIPTION
* The pthread_join(