pthread_setcancelstate(3pthread)
pthread_setcancelstate, pthread_setcanceltype, pthread_testcancel --
set cancelability state
SYNOPSIS
cc [options] -Kthread file
#include <pthread.h>
int pthread_setcancelstate(int state, int *oldstate);
int pthread_setcanceltype(int type, int *oldtype);
void pthread_testcancel(void);
Description
pthread_setcancelstate
atomically sets the calling thread's cancelability
state to the indicated
state
and returns the previous cancelability state
at the location referenced by oldstate.
Legal values for
state
are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DISABLE.
pthread_setcanceltype
atomically sets the calling thread's cancelability
type to the indicated
type
and returns the previous cancelability type
at the location referenced by oldtype.
Legal values for
type
are PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS.
The cancelability state and type of any newly
created threads, including the thread in which
main
was first invoked,
are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DEFERRED
respectively.
pthread_testcancel
creates a cancellation point in the calling thread.
It has no effect if cancelability is disabled.
Return values
pthread_setcancelstate
and
pthread_setcanceltype
return zero on success.
Otherwise, an error number is returned to indicate the error.
Diagnostics
pthread_setcancelstate returns the following value
if the corresponding error is detected:
EINVAL-
The specified state is not
PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.
pthread_setcanceltype returns the following value
if the corresponding error is detected:
EINVAL-
The specified type is not PTHREAD_CANCEL_DEFERRED
or PTHREAD_CANCEL_ASYNCHRONOUS.
Standards compliance
The Single UNIX Specification, Version 2; The Open Group.
References
pthread_cancel(3pthread),
pthread_cleanup_pop(3pthread),
pthread_cleanup_push(3pthread),
pthread(4)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004