How to find if pthread is waiting for a cancel request

I want to find if a thread was called, pthread_cancel .

I do not want to use some tables and maintain this. Is any library function available? I do not want to cancel the stream using some cancel point functions that cancel the stream if there is any pending cancel request, I just want to know if there is a pending cancel request or not.

+4
source share
1 answer

Even if you call pthread_cancel , it is not executed immediately. The processor takes its time to cancel the thread. But, just to mention here: using asynchronous undo or immediate undo is not recommended. I ran into a problem when my application crashed while canceling when using pthread_setcanceltype () as PTHREAD_CANCEL_ASYNCHRONOUS. I really could not find the reason. As far as I know, and even I searched a lot for this while debugging the crash script, we donโ€™t have a confirmation method at which point the thread is canceled.

0
source

Source: https://habr.com/ru/post/1441271/


All Articles