The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

pthread_cancel - cancel execution of a thread

 SYNOPSIS



#include <pthread.h>

int pthread_cancel(pthread_t thread);

 DESCRIPTION

The pthread_cancel() function requests that thread be canceled. The target threads cancelability state and type determines when the cancellation takes effect. When the cancellation is acted on, the cancellation cleanup handlers for thread are called. When the last cancellation cleanup handler returns, the thread-specific data destructor functions are called for thread. When the last destructor function returns, thread is terminated.

The cancellation processing in the target thread runs asynchronously with respect to the calling thread returning from pthread_cancel().

 RETURN VALUE

If successful, the pthread_cancel() function returns zero. Otherwise, an error number is returned to indicate the error.

 ERRORS

The pthread_cancel() function may fail if:
[ESRCH]
No thread could be found corresponding to that specified by the given thread ID.

The pthread_cancel() function will not return an error code of [EINTR].

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

pthread_exit(), pthread_join(), pthread_setcancelstate(), pthread_cond_wait(), pthread_cond_timedwait(), <pthread.h>.

DERIVATION

Derived from the POSIX Threads Extension (1003.1c-1995)

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]