pthread_join和pthread_detach

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.
posted @ 2020-07-13 19:50  倚剑天下  阅读(160)  评论(0编辑  收藏  举报