pthread_detach question

后端 未结 5 1909
鱼传尺愫
鱼传尺愫 2020-12-13 05:12

Till recently, I was under the impression that if you \"detach\" a thread after spawning it, the thread lives even after the \"main\" thread terminates.

But a litt

5条回答
  •  时光取名叫无心
    2020-12-13 05:57

    From man 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.

提交回复
热议问题