Standard C Library Functions pthreadtestcancel(3C)
NAME
pthreadtestcancel - create cancellation point in the cal-
ling thread
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include
void pthreadtestcancel(void);
DESCRIPTION
The pthreadtestcancel() function forces testing for cancel-
lation. This is useful when you need to execute code that
runs for long periods without encountering cancellation
points; such as a library routine that executes long-running
computations without cancellation points. This type of code
can block cancellation for unacceptable long periods of
time. One strategy for avoiding blocking cancellation for
long periods, is to insert calls to pthreadtestcancel() in
the long-running computation code and to setup a cancella-
tion handler in the library code, if required.
RETURN VALUES
The pthreadtestcancel() function returns void.
ERORS
The pthreadtestcancel() function does not return errors.
EXAMPLES
See cancellation(5) for an example of using
pthreadtestcancel() to force testing for cancellation and a
discussion of cancellation concepts.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO
Intro(3), pthreadcleanuppop(3C), pthreadcleanuppush(3C),
pthreadexit(3C), pthreadjoin(3C),
SunOS 5.11 Last change: 23 Mar 2005 1
Standard C Library Functions pthreadtestcancel(3C)
pthreadsetcancelstate(3C), pthreadsetcanceltype(3C),
setjmp(3C), attributes(5), cancellation(5), condition(5),
standards(5)
NOTES
The pthreadtestcancel() function has no effect if cancella-
tion is disabled.
Use pthreadtestcancel() with pthreadsetcanceltype() called
with its canceltype set to PTHREADCANCELDEFERED. The
pthreadtestcancel() function operation is undefined if
pthreadsetcanceltype() was called with its canceltype argu-
ment set to PTHREADCANCELASYNCHRONOUS.
It is possible to kill a thread when it is holding a
resource, such as lock or allocated memory. If that thread
has not setup a cancellation cleanup handler to release the
held resource, the application is "cancel-unsafe". See
attributes(5) for a discussion of Cancel-Safety, Deferred-
Cancel-Safety, and Asynchronous-Cancel-Safety.
SunOS 5.11 Last change: 23 Mar 2005 2
|