Cancel a thread
#include <pthread.h> int pthread_cancel( pthread_t thread );
- The ID of the thread that you want to cancel, which you can get when you call pthread_create() or pthread_self() .
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_cancel() function requests that the target thread thread be canceled (terminated). The cancellation type and state of the target determine when the cancellation takes effect.
When the cancellation is acted on, the target's cancellation cleanup handlers are called. When the last cancellation cleanup handler returns, the target's thread-specific-data destructor functions are called. When the last destructor function returns, the target is terminated. Cancellation processing in the target thread runs asynchronously with respect to the calling thread.
- No thread with thread ID thread exists.