PTHREAD_TESTCANCEL(3) BSD Programmer's Manual PTHREAD_TESTCANCEL(3)NAME
pthread_testcancel - request that the specified thread be canceled
SYNOPSIS
#include <pthread.h>
int
pthread_setcancelstate(int state, int *oldstate);
int
pthread_setcanceltype(int type, int *oldtype);
void
pthread_testcancel(void);
DESCRIPTION
The pthread_setcancelstate() function sets the cancelability state of the
calling thread to state. If oldstate is non-NULL the previous cancelabil-
ity state is return in the referenced location. Valid values for state
are PTHREAD_CANCEL_ENABLE (the default) and PTHREAD_CANCEL_DISABLE.
The pthread_setcanceltype() function sets the cancelability type of the
calling thread to type. If oldtype is non-NULL the previous cancelability
type is returned in the referenced location. Valid values for type are
PTHREAD_CANCEL_DEFERRED (the default) and PTHREAD_CANCEL_ASYNCHRONOUS.
The pthread_testcancel() function creates a cancellation point in the
calling thread. This cancellation point will only have an effect if can-
celability is enabled.
RETURN VALUES
If successful, the pthread_setcancelstate() and pthread_setcanceltype()
functions return zero. Otherwise, an error number is returned to indi-
cate the error.
ERRORS
For each of the following conditions, if the condition is detected, the
pthread_setcancelstate() function shall return the corresponding error
number:
[EINVAL] The specified state is not PTHREAD_CANCEL_ENABLE or
PTHREAD_CANCEL_DISABLE.
For each of the following conditions, if the condition is detected, the
pthread_setcanceltype() function shall return the corresponding error
number:
[EINVAL] The specified type is not PTHREAD_CANCEL_DEFERRED or
PTHREAD_CANCEL_ASYNCHRONOUS.
SEE ALSOpthreads(3), pthread_cancel(3), pthread_cond_timedwait(3),
pthread_cond_wait(3), pthread_exit(3), pthread_join(3)STANDARDS
The pthread_setcancelstate(), pthread_setcanceltype(), and
pthread_testcancel() functions conform to IEEE Std1003.1c (``POSIX'').
HISTORY
The pthread_setcancelstate(), pthread_setcanceltype(), and
pthread_testcancel() function first appeared in BSD/OS 4.1.
4th Berkeley Distribution Oct 1, 1999 1