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