Index of Section 2 Manual Pages
| Interix / SUA | pthread_testcancel.2 | Interix / SUA |
pthread_testcancel(2) pthread_testcancel(2)
pthread_setcancelstate()
NAME
pthread_setcancelstate(), pthread_setcanceltype(), pthread_testcancel() -
set thread cancelability
SYNOPSIS
#include
int pthread_setcancelstate(int state, int *oldstate);
int pthread_setcanceltype(int type, int *oldtype);
void pthread_testcancel(void);
DESCRIPTION
The pthread_setcancelstate(2) function sets the calling thread's
cancelability state to the value specified by the state argument and
returns the previous cancelability state in the location referenced by the
oldstate argument. The cancelability state can be set to either of the
following values:
* PTHREAD_CANCEL_ENABLE (the default) allows the thread to be canceled
* PTHREAD_CANCEL_DISABLE prevents a thread from being canceled
The pthread_setcanceltype(2) function sets the calling thread's
cancelability type to the value specified by the type argument and returns
the previous cancelability type in the location referenced by the oldtype
argument. The cancelability type can be set to either of the following
values:
* PTHREAD_CANCEL_DEFERRED (the default) allows thread cancellation
only at a cancellation point
* PTHREAD_CANCEL_ASYNCHRONOUS allows immediate cancellation
The pthread_testcancel(2) function creates a cancellation point in the
thread. This function has no effect if cancelability is disabled.
RETURN VALUES
On success, these functions return 0; otherwise, an error code is
returned.
ERRORS
The pthread_setcancelstate() function can fail for the following reason:
The pthread_setcanceltype() function can fail for the following reason:
[EINVAL]
The type argument is not set to PTHREAD_CANCEL_DEFERRED or
PTHREAD_CANCEL_ASYNCHRONOUS.
These functions do not return [EINTR].
SEE ALSO
pthread_cancel(2)
USAGE NOTES
All of these functions are thread safe.
None of these functions are async-signal safe.