I have a question regarding the pthread_cancel() call.
The docs state first any cleanup handlers are executed and then the threads data specific descructor functions.
Does this mean that stack is unwound for my thread and that all C++ class destructors are invoked?
I’m curious because I have some threads that I sometimes want to cancel. But these threads may control mutex’s. I know you can specifically do it in the cleanup handler. But if you don’t know what mutex’s you own (which you might not if your calling library code), you can hardly put them in the cleanup handler.
On the other hand if the stack unwinds during pthread_cancel() I will be OK because I unlock any mutexs when a function exits (hence unwinding the stack guarantees mutexs are unlocked).
Tim