pthread_cancel() function failed to terminate a thread

前端 未结 2 1278
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-06 03:48

I\'m using pthread_create() and pthread_cancel() functions to create a multithreaded program, but I noticed that pthread_cancel() did

2条回答
  •  囚心锁ツ
    2021-01-06 04:08

    The default cancel method of pthread_cancel() is delayed cancel.So when you invoke pthread_cancel(), it will not really cancel before the specified thread reach the cancel point.You shoud call pthread_setcanceltype to set another cancel method to your thread.

提交回复
热议问题