Linux thread execution differs from windows in thatPthread has two state joinable states and Unjoinable states
The default state of a thread is joinable, and if the thread is joinable state, the thread takes up the stack and the thread descriptor (a total of more than 8K) when the thread function returns to exit or Pthread_exit. These resources will be released only if you call Pthread_join.
These resources are automatically freed when the thread function exits or pthread_exit, if the threads are in a unjoinable state.
The Unjoinable property can be specified at pthread_create time, or Pthread_detach itself in the thread after the thread is created, such as: Pthread_detach (Pthread_self ()), Change the status to Unjoinable state to ensure the release of the resource. If the thread state is joinable, you need to call Pthread_join at a later time.
C + + multithreaded Learning