Sets the cancel state of the calling thread, which determines whether the thread can be cancelled.
#include <pthread.h> int pthread_setcancelstate ( int state, int *oldstate);
(IN) Specifies the new cancel state for the thread using one of the following flags:
(OUT) Points to the old cancel state for the thread.
If successful, returns 0; otherwise, returns a nonzero error code:
The cancel state of new threads is, by default, PTHREAD_CANCEL_ENABLE. When cancellation is enabled, the library performs cancellation at many points in its functions.
The pthread_setcancelstate function permits explicit cancellation-point management. A cancellation point is any point at which a thread might be suspended or killed. Many of the library's functions offer cancellation points upon entry and exit to or from the function. If a thread is holding a lock or other resource on which other threads might depend or wait, it must not be allowed to be cancelled by the library.
On NetWare, an application can call outside LibC into another library or service and acquire resources (especially locks) that are unknown to the library. It is probably best not to permit the library to kill or suspend the thread while it holds these resources.