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