Initial import from FreeBSD RELENG_4:
[dragonfly.git] / lib / libc_r / man / pthread_cancel.3
CommitLineData
984263bc
MD
1.\" $FreeBSD: src/lib/libc_r/man/pthread_cancel.3,v 1.3.2.4 2001/12/17 10:08:26 ru Exp $
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 LIBRARY
9.Lb libc_r
10.Sh SYNOPSIS
11.In pthread.h
12.Ft int
13.Fn pthread_cancel "pthread_t thread"
14.Sh DESCRIPTION
15The
16.Fn pthread_cancel
17function requests that
18.Fa thread
19be canceled.
20The target thread's cancelability state and type determines
21when the cancellation takes effect.
22When the cancellation is acted on,
23the cancellation cleanup handlers for
24.Fa thread
25are called.
26When the last cancellation cleanup handler returns,
27the thread-specific data destructor functions will be called for
28.Fa thread .
29When the last destructor function returns,
30.Fa thread
31will be terminated.
32.Pp
33The cancellation processing in the target thread runs asynchronously with
34respect to the calling thread returning from
35.Fn pthread_cancel .
36.Pp
37A status of
38.Dv PTHREAD_CANCELED
39is made available to any threads joining with the target.
40The symbolic
41constant
42.Dv PTHREAD_CANCELED
43expands to a constant expression of type
44.Ft "(void *)" ,
45whose value matches no pointer to an object in memory nor the value
46.Dv NULL .
47.Sh RETURN VALUES
48If successful, the
49.Fn pthread_cancel
50functions will return zero.
51Otherwise an error number will be returned to
52indicate the error.
53.Sh ERRORS
54.Fn pthread_cancel
55will 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
70.Fn pthread_cancel
71conforms to
72.St -p1003.1-96 .
73.Sh AUTHORS
74This man page was written by
75.An David Leonard Aq d@openbsd.org
76for the
77.Ox
78implementation of
79.Fn pthread_cancel .