Home > OS >  Questions about the pthread_detach, please help solve it
Questions about the pthread_detach, please help solve it

Time:11-11

I now know that if you use the pthread_join function, the main thread will wait for the child and then continue to perform the thread has been completed using the pthread_detach threads after separation, make the main thread without waiting for the thread automatically after the recycling of resources, and then I wrote a simple multithreaded, results jump straight to the end of the main thread part, after using pthread_detach I understand, the main thread thread won't wait for the child, in this case, that should make the main thread after don't wait for the child thread pthread_create directly, why use pthread_detach? For bosses to solve?

CodePudding user response:

A thread can be combined at the end of the run, if no call pthread_join, get into a similar zombie process state, also is in the system and some resources recycling,
  • Related