1.Dd January 17, 1999 2.Dt PTHREAD_CANCEL 3 3.Os 4.Sh NAME 5.Nm pthread_cancel 6.Nd cancel execution of a thread 7.Sh SYNOPSIS 8.Fd #include <pthread.h> 9.Ft int 10.Fn pthread_cancel "pthread_t thread" 11.Sh DESCRIPTION 12The 13.Fn pthread_cancel 14function requests that 15.Fa thread 16be canceled. The target thread's cancelability state and type determines 17when the cancellation takes effect. When the cancellation is acted on, 18the cancellation cleanup handlers for 19.Fa thread 20are called. When the last cancellation cleanup handler returns, 21the thread-specific data destructor functions will be called for 22.Fa thread . 23When the last destructor function returns, 24.Fa thread 25will be terminated. 26.Pp 27The cancellation processing in the target thread runs asynchronously with 28respect to the calling thread returning from 29.Fn pthread_cancel . 30.Pp 31A status of 32.Dv PTHREAD_CANCELED 33is made available to any threads joining with the target. The symbolic 34constant 35.Dv PTHREAD_CANCELED 36expands to a constant expression of type 37.Ft "(void *)" , 38whose value matches no pointer to an object in memory nor the value 39.Dv NULL . 40.Sh RETURN VALUES 41If successful, the 42.Fn pthread_cancel 43functions will return zero. Otherwise an error number will be returned to 44indicate the error. 45.Sh ERRORS 46.Fn pthread_cancel 47will fail if: 48.Bl -tag -width Er 49.It Bq Er ESRCH 50No thread could be found corresponding to that specified by the given 51thread ID. 52.El 53.Sh SEE ALSO 54.Xr pthread_testcancel 3 , 55.Xr pthread_setcancelstate 3 , 56.Xr pthread_setcanceltype 3 , 57.Xr pthread_cleanup_pop 3 , 58.Xr pthread_cleanup_push 3 , 59.Xr pthread_exit 3 , 60.Xr pthread_join 3 61.Sh STANDARDS 62.Fn pthread_cancel 63conforms to ISO/IEC 9945-1 ANSI/IEEE 64.Pq Dq Tn POSIX 65Std 1003.1 Second Edition 1996-07-12. 66