1pthread_setcanceltype(3C)Standard C Library Functionspthread_setcanceltype(3C)
2
3
4
6 pthread_setcanceltype - set cancellation type of a thread
7
9 cc -mt [ flag... ] file... -lpthread [ library... ]
10 #include <pthread.h>
11
12 int pthread_setcanceltype(int type, int *oldtype);
13
14
16 The pthread_setcanceltype() function atomically sets the calling
17 thread's cancellation type to the specified type and, if oldtype is
18 not NULL, stores the previous cancellation type in oldtype. The type
19 can be either of the following:
20
21 PTHREAD_CANCEL_DEFERRED
22
23 This is the default. When cancellation is enabled (enabled cancel‐
24 lation is also the default), cancellation occurs when the target
25 thread reaches a cancellation point and a cancel is pending. When
26 cancellation is disabled, all cancellation requests to the target
27 thread are held pending.
28
29
30 PTHREAD_CANCEL_ASYNCHRONOUS
31
32 When cancellation is enabled, receipt of a pthread_cancel(3C) call
33 causes immediate cancellation. When cancellation is disabled, all
34 cancellation requests to the target thread are held pending; as
35 soon as cancellation is re-enabled, pending cancellations are exe‐
36 cuted immediately.
37
38
39
40 See cancellation(5) for the definition of a cancellation point and a
41 discussion of cancellation concepts. See pthread_setcancelstate(3C) for
42 explanations of enabling and disabling cancellation.
43
44
45 The pthread_setcanceltype() function is a cancellation point if type is
46 called with PTHREAD_CANCEL_ASYNCHRONOUS and the cancellation state is
47 PTHREAD_CANCEL_ENABLE.
48
50 Upon successful completion, the pthread_setcanceltype() function
51 returns 0. Otherwise, an error number is returned to indicate the
52 error.
53
55 The pthread_setcanceltype() function will fail if:
56
57 EINVAL The specified type is not PTHREAD_CANCEL_DEFERRED or
58 PTHREAD_CANCEL_ASYNCHRONOUS.
59
60
62 See attributes(5) for descriptions of the following attributes:
63
64
65
66
67 ┌─────────────────────────────┬─────────────────────────────┐
68 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
69 ├─────────────────────────────┼─────────────────────────────┤
70 │Interface Stability │Standard │
71 ├─────────────────────────────┼─────────────────────────────┤
72 │MT-Level │MT-Safe │
73 └─────────────────────────────┴─────────────────────────────┘
74
76 pthread_cancel(3C), pthread_cleanup_pop(3C), pthread_cleanup_push(3C),
77 pthread_exit(3C), pthread_join(3C), pthread_setcancelstate(3C),
78 pthread_testcancel(3C), setjmp(3C), attributes(5), cancellation(5),
79 condition(5), standards(5)
80
81
82
83SunOS 5.11 23 Mar 2005 pthread_setcanceltype(3C)