pthread_join(pthread_t thread, void **retval)
The pthread_join() function waits for the thread specified by thread to terminate. If that thread has already terminated, then pthread_join() returns immediately. The thread specified by thread must be joinable.
pthread_join成功调用时,调用线程被阻塞,直到由thread指定的线程终止(如果线程已经终止,pthread_join会立即返回)
pthread_detach
The pthread_detach() function marks the thread identified by thread as detached. When a detached thread terminates, its resources are automatically released back to the system without the need for another thread to join with the terminated thread.