Do you need to join a cancelled thread? (pthreads)

前端 未结 5 1219
孤城傲影
孤城傲影 2021-01-03 02:12

I\'m a little confused about clean-up order when you\'re using PThreads with regard to cancellation. Normally, if your thread is detached, it automatically cleans up when i

5条回答
  •  日久生厌
    2021-01-03 02:52

    From Doccumentation of pthread_cancel():

    After a canceled thread has terminated, a join with that thread using pthread_join(3) obtains PTHREAD_CANCELED as the thread's exit status. (Joining with a thread is the only way to know that cancellation has completed.)

提交回复
热议问题