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