Detached vs. Joinable POSIX threads
问题 I\'ve been using the pthread library for creating & joining threads in C. When should I create a thread as detached, right from the outset? Does it offer any performance advantage vs. a joinable thread? Is it legal to not do a pthread_join() on a joinable (by default) thread? Or should such a thread always use the detach() function before pthread_exit() ing? 回答1: Create a detached thread when you know you won't want to wait for it with pthread_join() . The only performance benefit is that