## NAME

pthread_cancel - cancel execution of a thread

## SYNOPSIS

#include <pthread.h>

int pthread_cancel(pthread_t thread);

## DESCRIPTION

pthread_cancel() function 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 will be called. When the last cancellation cleanup handler returns, the thread-specific data destructor functions will be called for thread. When the last destructor function returns, thread will be terminated.

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

## RETURN VALUES

If successful, the pthread_cancel() returns zero; otherwise, an error number will be returned to indicate the error.

## ERRORS

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

## SEE ALSO

pthread_exit(), pthread_setcancelstate()

#### Home page (Kernel)

## < Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >