DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

pthread_cancel(PTHREAD)


pthread_cancel -- cancel execution of a thread

SYNOPSIS

   cc [options] -Kthread file
   

#include <pthread.h>

int pthread_cancel(pthread_t thread);

Description

pthread_cancel requests that thread be canceled. The target thread's 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 values

pthread_cancel function returns zero on success. Otherwise, an error number is returned to indicate the error.

Diagnostics

The pthread_cancel function may fail if:

ESRCH
No thread could be found corresponding to that specified by the given thread ID.

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.

References

pthread(F) pthread_cleanup_pop(PTHREAD), pthread_cleanup_push(PTHREAD), pthread_exit(PTHREAD), pthread_join(PTHREAD), pthread_setcancelstate(PTHREAD), pthread_setcanceltype(PTHREAD), pthread_testcancel(PTHREAD),
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005