Sets the current thread's cancelability type.
pthread_setcanceltype( type, oldtype );
Argument Data Type Accesstype integer read oldtype integer write
#includeint pthread_setcanceltype ( int type, int *oldtype);
When the cancelability state is set to PTHREAD_CANCEL_DISABLE, (see pthread_setcancelstate), a cancel cannot be delivered to the thread, even if a cancelable routine is called or asynchronous cancelability type is enabled.
When the cancelability state is set to PTHREAD_CANCEL_ENABLE, cancelability depends on the thread's cancelability type. When the thread's cancelability state is PTHREAD_CANCEL_ENABLE and the thread's cancelability type is set to PTHREAD_CANCEL_DEFERRED, the thread can only receive a cancel at specific cancellation points (including condition waits, thread joins, and calls to pthread_ testcancel.) If the thread's cancelability state is PTHREAD_CANCEL_ ENABLE and its cancelability type is PTHREAD_CANCEL_ASYNCHRONOUS, the thread can be canceled at any point in its execution.
When a thread is created, the default cancelability type is PTHREAD_CANCEL_DEFERRED.
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Return Description0 Successful completion. [EINVAL] The specified type is not PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_AYNCHRONOUS.
pthread_cancel pthread_setcancelstate pthread_testcancel