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