xref: /freebsd/share/man/man3/pthread_cancel.3 (revision 7285bccf1a9224fadd3b7b81be034cd04f35a820)
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. The target thread's cancelability state and type determines
18when the cancellation takes effect. When the cancellation is acted on,
19the cancellation cleanup handlers for
20.Fa thread
21are called. When the last cancellation cleanup handler returns,
22the thread-specific data destructor functions will be called for
23.Fa thread .
24When the last destructor function returns,
25.Fa thread
26will be terminated.
27.Pp
28The cancellation processing in the target thread runs asynchronously with
29respect to the calling thread returning from
30.Fn pthread_cancel .
31.Pp
32A status of
33.Dv PTHREAD_CANCELED
34is made available to any threads joining with the target. The symbolic
35constant
36.Dv PTHREAD_CANCELED
37expands to a constant expression of type
38.Ft "(void *)" ,
39whose value matches no pointer to an object in memory nor the value
40.Dv NULL .
41.Sh RETURN VALUES
42If successful,  the
43.Fn pthread_cancel
44functions will return zero. Otherwise an error number will be returned to
45indicate the error.
46.Sh ERRORS
47.Fn pthread_cancel
48will fail if:
49.Bl -tag -width Er
50.It Bq Er ESRCH
51No thread could be found corresponding to that specified by the given
52thread ID.
53.El
54.Sh SEE ALSO
55.Xr pthread_cleanup_pop 3 ,
56.Xr pthread_cleanup_push 3 ,
57.Xr pthread_exit 3 ,
58.Xr pthread_join 3 ,
59.Xr pthread_setcancelstate 3 ,
60.Xr pthread_setcanceltype 3 ,
61.Xr pthread_testcancel 3
62.Sh STANDARDS
63.Fn pthread_cancel
64conforms to ISO/IEC 9945-1 ANSI/IEEE
65.Pq Dq Tn POSIX
66Std 1003.1 Second Edition 1996-07-12.
67.Sh AUTHORS
68This man page was written by
69.An David Leonard <d@openbsd.org>
70for the OpenBSD implementation of pthread_cancel.
71