.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
.\" <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
-.TH PTHREAD_SETCANCELSTATE 3 2008-11-24 "Linux" "Linux Programmer's Manual"
+.TH PTHREAD_SETCANCELSTATE 3 2014-05-13 "Linux" "Linux Programmer's Manual"
.SH NAME
pthread_setcancelstate, pthread_setcanceltype \-
set cancelability state and type
.IR type .
.\" .SH VERSIONS
.\" Available since glibc 2.0
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR pthread_setcancelstate ()
+and
+.BR pthread_setcanceltype ()
+functions are thread-safe.
.SH CONFORMING TO
POSIX.1-2001.
.SH NOTES
Beware of disabling cancelability for long periods,
or around operations that may block for long periods,
since that will render the thread unresponsive to cancellation requests.
-
+.SS Asynchronous cancelability
Setting the cancelability type to
.B PTHREAD_CANCEL_ASYNCHRONOUS
is rarely useful.
family of functions) may be left in an inconsistent state
if cancellation occurs in the middle of the function call.
Consequently, clean-up handlers cease to be useful.
+
Functions that can be safely asynchronously canceled are called
.IR "async-cancel-safe functions" .
-POSIX.1-2001 only requires that
+POSIX.1-2001 requires only that
.BR pthread_cancel (3),
.BR pthread_setcancelstate (),
and
be async-cancel-safe.
In general, other library functions
can't be safely called from an asynchronously cancelable thread.
+
One of the few circumstances in which asynchronous cancelability is useful
is for cancellation of a thread that is in a pure compute-bound loop.
-
+.SS Portability notes
The Linux threading implementations permit the
.I oldstate
argument of
.BR pthread_cleanup_push (3),
.BR pthread_testcancel (3),
.BR pthreads (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.