Unconditionally terminate the target thread
#include <pthread.h> int pthread_abort( pthread_t thread );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pthread_abort() function terminates the target thread. Termination takes effect immediately and isn't a function of the cancelability state of the target thread. No cancellation handlers or thread-specific-data destructor functions are executed. Thread abortion doesn't release any application-visible process resources, including, but not limited to, mutexes and file descriptors. (The behavior of POSIX calls following a call to pthread_abort() is unspecified.)
The status of PTHREAD_ABORTED is available to any thread joining with the target thread. The constant PTHREAD_ABORTED expands to a constant expression, of type void *. Its value doesn't match any pointer to an object in memory, or the values NULL and PTHREAD_CANCELED.
The side effects of aborting a thread that's suspended during a call of a POSIX 1003.1 function are the same as the side effects that may be seen in a single-threaded process when a call to a POSIX 1003.1 function is interrupted by a signal and the given function returns EINTR. Any such side effects occur before the thread terminates.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |