OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / glibc-linuxthreads / release / man3 / pthread_cancel.3
1 .\"   Copyright (C) 1994-1999 Free Software Foundation, Inc.
2 .\"
3 .\"   Permission is granted to make and distribute verbatim copies of
4 .\" this manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\"   Permission is granted to copy and distribute modified versions of
8 .\" this manual under the conditions for verbatim copying, provided that
9 .\" the entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\"   Permission is granted to copy and distribute translations of this
13 .\" manual into another language, under the above conditions for modified
14 .\" versions, except that this permission notice may be stated in a
15 .\" translation approved by the Foundation.
16 .\"
17 .\" Copyright (C) 1999 Xavier Leroy.
18 .\" 
19 .\" Japanese Version Copyright (C) 2000 WAKABAYASHI, Takeyasu
20 .\"         all rights reserved.
21 .\" Translated on Fri Jan 14 16:50:24 JST 2000
22 .\"         by WAKABAYASHI, Takeyasu <twakaba@eco.toyama-u.ac.jp>
23 .\"
24 .\" 
25 .\" .TH PTHREAD_CANCEL 3 LinuxThreads
26 .\"
27 .\"
28 .\" .SH NAME
29 .\" pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, pthread_testcancel \- thread cancellation
30 .\"
31 .\" .SH SYNOPSIS
32 .\" .B #include <pthread.h>
33 .\"
34 .\" .BI "int pthread_cancel(pthread_t " thread ");"
35 .\"
36 .\" .BI "int pthread_setcancelstate(int " state ", int *" oldstate ");"
37 .\"
38 .\" .BI "int pthread_setcanceltype(int " type ", int *" oldtype ");"
39 .\"
40 .\" .BI "void pthread_testcancel(void);"
41 .TH PTHREAD_CANCEL 3 LinuxThreads
42
43
44 .SH NAME
45 pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, pthread_testcancel \- ¥¹¥ì¥Ã¥É¤Î¼è¤ê¾Ã¤·
46
47 .SH ½ñ¼°
48 .B #include <pthread.h>
49
50 .BI "int pthread_cancel(pthread_t " thread ");"
51
52 .BI "int pthread_setcancelstate(int " state ", int *" oldstate ");"
53
54 .BI "int pthread_setcanceltype(int " type ", int *" oldtype ");"
55
56 .BI "void pthread_testcancel(void);"
57
58 .\" .SH DESCRIPTION
59 .\"
60 .\" Cancellation is the mechanism by which a thread can terminate the
61 .\" execution of another thread. More precisely, a thread can send a
62 .\" cancellation request to another thread. Depending on its settings, the
63 .\" target thread can then either ignore the request, honor it
64 .\" immediately, or defer it till it reaches a cancellation point.
65 .SH ÀâÌÀ
66
67 ¼è¤ê¾Ã¤·¤Ï¡¢¤¢¤ë¥¹¥ì¥Ã¥É¤¬Â¾¤Î¥¹¥ì¥Ã¥É¤Î¼Â¹Ô¤ò½ªÎ»¤µ¤»¤ë¤³¤È¤ò²Äǽ
68 ¤Ë¤¹¤ë¥á¥«¥Ë¥º¥à¤Ç¤¢¤ë¡£¤è¤êÀµ³Î¤Ë¤Ï¡¢¥¹¥ì¥Ã¥É¤Ï¾¤Î¥¹¥ì¥Ã¥É¤ËÂФ·¤Æ
69 ¼è¾ÃÍ×µá¤òÁ÷¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ÀßÄ꼡Âè¤Ç¡¢ÌÜɸ¤Î¥¹¥ì¥Ã¥É¤Ï¡¢Í×µá¤ò̵»ë
70 ¤·¤¿¤ê¡¢Ä¾¤Á¤Ë¼Â¸½¤·¤¿¤ê¡¢¤¢¤ë¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ë»ê¤ë¤Þ¤Ç¤½¤ÎÍ×µá¤Î¼Â¹Ô
71 ¤ò±ä´ü¤·¤¿¤ê¤Ç¤­¤ë¡£
72
73 .\" When a thread eventually honors a cancellation request, it performs as
74 .\" if 
75 .\" .B "pthread_exit(PTHREAD_CANCELED)"
76 .\" has been called at that point:
77 .\" all cleanup handlers are executed in reverse order, finalization
78 .\" functions for thread-specific data are called, and finally the thread
79 .\" stops executing with the return value 
80 .\" .BR "PTHREAD_CANCELED" .
81 .\" See
82 .\" .BR "pthread_exit" (3)
83 .\" for more information.
84 ¥¹¥ì¥Ã¥É¤¬ºÇ½ªÅª¤Ë¼è¤ê¾Ã¤·Í×µá¤ò¼Â¸½¤¹¤ëºÝ¤Ë¤Ï¡¢¤½¤ì¤Ï¤¢¤¿¤«¤â
85 .B "pthread_exit(PTHREAD_CANCELED)"
86 ¤¬¤½¤Î»þÅÀ¤Ç¸Æ¤Ó½Ð¤µ¤ì¤¿¤«¤Î¤è¤¦¤Ë¿¶Éñ¤¦¡£¤¹¤Ê¤ï¤Á¡¢Á´¤Æ¤Î¥¯¥ê¡¼¥ó
87 ¥¢¥Ã¥×¥Ï¥ó¥É¥é¤¬µÕ½ç¤Ë¼Â¹Ô¤µ¤ì¡¢¥¹¥ì¥Ã¥É¸ÇÍ­¥Ç¡¼¥¿¤Î½ªÎ»½èÍý´Ø¿ô¤¬
88 ¸Æ¤Ó½Ð¤µ¤ì¡¢ºÇ¸å¤Ë¥¹¥ì¥Ã¥É¤Ï¡¢ÊÖ¤êÃÍ
89 .BR "PTHREAD_CANCEL"
90 ¤Ç¼Â¹Ô¤òÄä»ß¤¹¤ë¡£¾Ü¤·¤¯¤Ï
91 .BR "pthread_exit" (3)
92 ¤ò¸«¤è¡£
93
94 .\" .B "pthread_cancel"
95 .\" sends a cancellation request to the thread denoted
96 .\" by the 
97 .\" .I "thread"
98 .\" argument.
99 .BR "pthread_cancel"
100 ¤Ï
101 .I "thread"
102 °ú¿ô¤Ç»ØÄꤵ¤ì¤¿¥¹¥ì¥Ã¥É¤ËÂФ·¤Æ¡¢¼è¤ê¾Ã¤·Í×µá¤òÁ÷¤ë¡£
103
104 .\" .B "pthread_setcancelstate"
105 .\" changes the cancellation state for the
106 .\" calling thread -- that is, whether cancellation requests are ignored
107 .\" or not. The 
108 .\" .I "state"
109 .\" argument is the new cancellation state: either
110 .\" .B "PTHREAD_CANCEL_ENABLE"
111 .\" to enable cancellation, or
112 .\" .B "PTHREAD_CANCEL_DISABLE"
113 .\" to disable cancellation (cancellation
114 .\" requests are ignored). If 
115 .\" .I "oldstate"
116 .\" is not 
117 .\" .BR "NULL" ,
118 .\" the previous
119 .\" cancellation state is stored in the location pointed to by 
120 .\" .IR "oldstate" ,
121 .\" and can thus be restored later by another call to
122 .\" .BR "pthread_setcancelstate" .
123 .B "pthread_setcancelstate"
124 ¤Ï¡¢¤³¤ì¤ò¸Æ¤Ó½Ð¤¹¥¹¥ì¥Ã¥É¤Î¼è¤ê¾Ã¤·¾õÂÖ¤òÊѹ¹¤¹¤ë¡£
125 ¤¹¤Ê¤ï¤Á¡¢¼è¤ê¾Ã¤·Í×µá¤ò¼õ¤±Æþ¤ì¤ë¤«Èݤ«¤òÊѹ¹¤¹¤ë¡£
126 .I "state"
127 °ú¿ô¤Ï¿·¤¿¤Ê¼è¤ê¾Ã¤·¾õÂ֤Ǥ¢¤ë¡£¤³¤ì¤Ï¼è¤ê¾Ã¤·¤ò²Äǽ¤Ë¤¹¤ë
128 .B "PTHREAD_CANCEL_ENABLE"
129 ¤â¤·¤¯¤Ï¡¢¼è¤ê¾Ã¤·¤òÉÔ²Äǽ¤Ë¤¹¤ë(¼è¤ê¾Ã¤·Í×µá¤ò̵»ë¤¹¤ë)
130 .B "PTHREAD_CANCEL_DISABLE"
131 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
132 .I "oldstate"
133 ¤¬
134 .BR "NULL"
135 ¤Ç¤Ê¤±¤ì¤Ð¡¢°ÊÁ°¤Î¼è¤ê¾Ã¤·¾õÂÖ¤¬
136 .IR "oldstate"
137 ¤¬»Ø¤¹¾ì½ê¤Ë³ÊǼ¤µ¤ì¡¢½¾¤Ã¤Æ¡¢¸å¤ÇÊ̤Î
138 .BR "pthread_setcancelstate"
139 ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤ê¡¢²óÉü¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
140
141 .\" .B "pthread_setcanceltype"
142 .\" changes the type of responses to cancellation
143 .\" requests for the calling thread: asynchronous (immediate) or deferred.
144 .\" The 
145 .\" .I "type"
146 .\" argument is the new cancellation type: either
147 .\" .B "PTHREAD_CANCEL_ASYNCHRONOUS"
148 .\" to cancel the calling thread as soon as
149 .\" the cancellation request is received, or 
150 .\" .B "PTHREAD_CANCEL_DEFERRED"
151 .\" to
152 .\" keep the cancellation request pending until the next cancellation
153 .\" point. If 
154 .\" .I "oldtype"
155 .\" is not 
156 .\" .BR "NULL" ,
157 .\" the previous
158 .\" cancellation state is stored in the location pointed to by 
159 .\" .IR "oldtype" ,
160 .\" and can thus be restored later by another call to
161 .\" .BR "pthread_setcanceltype" .
162 .B "pthread_setcanceltype"
163 ¤Ï¡¢¤³¤ì¤ò¸Æ¤Ó½Ð¤¹¥¹¥ì¥Ã¥É¤Î¼è¤ê¾Ã¤·Í×µá¤ËÂФ¹¤ëÈ¿±þ¤Î·¿¤òÊѹ¹¤¹¤ë¡£
164 ¤³¤ì¤Ï¡¢ÈóƱ´ü(¨»þ)¤Þ¤¿¤ÏÃÙ±ä¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
165 .I "type"
166 °ú¿ô¤Ï¡¢¿·¤¿¤Ê¼è¤ê¾Ã¤·Êý¤Ç¤¢¤ê¡¢¼è¤ê¾Ã¤·Í׵᤬ÆϤ¯¤Èľ¤Á¤Ë¸Æ¤Ó½Ð¤·
167 ¥¹¥ì¥Ã¥É¤ò¼è¤ê¾Ã¤¹
168 .B "PTHREAD_CANCEL_ASYNCHRONOUS"
169 ¤«¡¢¼è¤ê¾Ã¤·Í×µá¤ò¼¡¤Î¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Þ¤ÇαÊݤ¹¤ë
170 .B "PTHREAD_CANCEL_DEFERRED"
171 ¤«¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
172 .I "oldtype"
173 ¤¬
174 .BR "NULL"
175 ¤Ç¤Ê¤±¤ì¤Ð¡¢°ÊÁ°¤Î¼è¤ê¾Ã¤··¿¤¬
176 .IR "oldtype"
177 ¤Î»Ø¤¹¾ì½ê¤Ë³ÊǼ¤µ¤ì¡¢½¾¤Ã¤Æ¡¢¸å¤«¤éÊ̤Î
178 .BR "pthread_setcanceltype"
179 ¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤Æ²óÉü¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¢¤ë¡£
180
181 .\" Threads are always created by 
182 .\" .BR "pthread_create" (3)
183 .\" with cancellation
184 .\" enabled and deferred. That is, the initial cancellation state is
185 .\" .B "PTHREAD_CANCEL_ENABLE"
186 .\" and the initial type is
187 .\" .BR "PTHREAD_CANCEL_DEFERRED" .
188 ¥¹¥ì¥Ã¥É¤Ï¾ï¤Ë
189 .BR "pthread_create" (3)
190 ¤Ë¤è¤Ã¤Æ¡¢¼è¤ê¾Ã¤·²Äǽ¤«¤ÄÃÙ±ä¤ÇºîÀ®¤µ¤ì¤ë¡£
191 ¤¹¤Ê¤ï¤Á¡¢½é´ü¤Î¼è¤ê¾Ã¤·¾õÂÖ¤Ï
192 .B "PTHREAD_CANCEL_ENABLE"
193 ¤Ç¤¢¤ê¡¢½é´ü¤Î·¿¤Ï
194 .BR "PTHREAD_CANCEL_DEFERRED"
195 ¤Ç¤¢¤ë¡£
196
197 .\" Cancellation points are those points in the program execution where a
198 .\" test for pending cancellation requests is performed and cancellation
199 .\" is executed if positive. The following POSIX threads functions
200 .\" are cancellation points:
201 ¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤È¤Ï¡¢ÊÝαÃæ¤Î¼è¤ê¾Ã¤·Í×µá¤ËÂФ¹¤ë¥Æ¥¹¥È¤¬¹Ô¤ï¤ì¡¢
202 ¼ÂºÝ¤ËÍ׵᤬¤¢¤ì¤Ð¼è¤ê¾Ã¤·¤¬¼Â¹Ô¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£°Ê²¼¤Î POSIX ¥¹¥ì¥Ã¥É
203 ´Ø¿ô¤Ï¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ç¤¢¤ë:
204
205 .\" .BR "pthread_join" (3)
206 .\" .br
207 .\" .BR "pthread_cond_wait" (3)
208 .\" .br
209 .\" .BR "pthread_cond_timedwait" (3)
210 .\" .br
211 .\" .BR "pthread_testcancel" (3)
212 .\" .br
213 .\" .BR "sem_wait" (3)
214 .\" .br
215 .\" .BR "sigwait" (3)
216 .BR "pthread_join" (3)
217 .br
218 .BR "pthread_cond_wait" (3)
219 .br
220 .BR "pthread_cond_timedwait" (3)
221 .br
222 .BR "pthread_testcancel" (3)
223 .br
224 .BR "sem_wait" (3)
225 .br
226 .BR "sigwait" (3)
227
228 .\" All other POSIX threads functions are guaranteed not to be
229 .\" cancellation points. That is, they never perform cancellation in
230 .\" deferred cancellation mode.
231 ¤³¤ì°Ê³°¤ÎÁ´¤Æ¤Î POSIX ¥¹¥ì¥Ã¥É´Ø¿ô¤Ï¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ç¤Ï¤Ê¤¤¤³¤È¤¬ÊݾÚ
232 ¤µ¤ì¤Æ¤¤¤ë¡£¤¹¤Ê¤ï¤Á¡¢¤½¤ì¤é¤ÏÃÙ±ä¼è¤ê¾Ã¤·¥â¡¼¥É¤Ç·è¤·¤Æ¼è¤ê¾Ã¤·¤ò
233 ¼Â¸½¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
234
235 .\" .B "pthread_testcancel"
236 .\" does nothing except testing for pending
237 .\" cancellation and executing it. Its purpose is to introduce explicit
238 .\" checks for cancellation in long sequences of code that do not call
239 .\" cancellation point functions otherwise.
240 .B "pthread_testcancel"
241 ¤ÏÊÝαÃæ¤Î¼è¤ê¾Ã¤·Í×µá¤òÄ´¤Ù¡¢¤½¤ì¤ò¼Â¸½¤¹¤ë¤À¤±¤Ç¤¢¤ë¡£¤½¤ÎÌÜŪ¤Ï¡¢
242 ¾¤Ë¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤È¤Ê¤ë´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Î¤Ê¤¤¡¢Ä¹¤¤Ï¢Â³¤·¤¿
243 ¥³¡¼¥É¤ÎÃæ¤Ë¡¢ÌÀ¼¨Åª¤Ë¼è¤ê¾Ã¤·¤Î¥Á¥§¥Ã¥¯¤òƳÆþ¤¹¤ë¤³¤È¤Ç¤¢¤ë¡£
244
245 .\" .SH "RETURN VALUE"
246 .\"
247 .\" .BR "pthread_cancel" ,
248 .\" .B "pthread_setcancelstate"
249 .\" and
250 .\" .B "pthread_setcanceltype"
251 .\" return 0 on success and a non-zero error code
252 .\" on error.
253 .SH ÊÖ¤êÃÍ
254
255 .BR "pthread_cancel"¡¢
256 .B "pthread_setcancelstate"
257 ¤ª¤è¤Ó
258 .B "pthread_setcanceltype"
259 ¤ÏÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤Ê¤é¤Ð¡¢Èó¥¼¥í¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÖ¤¹¡£
260
261 .\" .SH ERRORS
262 .\"
263 .\" .B "pthread_cancel"
264 .\" returns the following error code on error:
265 .\" .RS
266 .\" .TP
267 .\" .B "ESRCH"
268 .\" no thread could be found corresponding to that specified by the 
269 .\" .I "thread"
270 .\" ID.
271 .\" .RE
272 .SH ¥¨¥é¡¼
273 .B "pthread_cancel"
274 ¤Ï¥¨¥é¡¼¤ÎºÝ¤Ë¼¡¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÖ¤¹:
275 .RS
276 .TP
277 .B "ESRCH"
278 .I "thread"
279 ¤Ç»ØÄꤵ¤ì¤¿¤â¤Î¤ËÂбþ¤¹¤ë¥¹¥ì¥Ã¥É¤¬Â¸ºß¤·¤Ê¤¤¡£
280 ID.
281 .RE
282
283 .\" .B "pthread_setcancelstate"
284 .\" returns the following error code on error:
285 .\" .RS
286 .\" .TP
287 .\" .B "EINVAL"
288 .\" the 
289 .\" .I "state"
290 .\" argument is not 
291 .\" .B "PTHREAD_CANCEL_ENABLE"
292 .\" nor
293 .\" .B "PTHREAD_CANCEL_DISABLE"
294 .\" .RE
295 .B "pthread_setcancelstate"
296 ¤Ï¥¨¥é¡¼¤ÎºÝ¤Ë¼¡¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÖ¤¹:
297 .RS
298 .TP
299 .B "EINVAL"
300 .I "state"
301 ¤¬
302 .B "PTHREAD_CANCEL_ENABLE"
303 ¤Ç¤â
304 .B "PTHREAD_CANCEL_DISABLE"
305 ¤Ç¤â¤Ê¤¤¡£
306 .RE
307
308 .\" .B "pthread_setcanceltype"
309 .\" returns the following error code on error:
310 .\" .RS
311 .\" .TP
312 .\" .B "EINVAL"
313 .\" the 
314 .\" .I "type"
315 .\" argument is not 
316 .\" .B "PTHREAD_CANCEL_DEFERRED"
317 .\" nor
318 .\" .B "PTHREAD_CANCEL_ASYNCHRONOUS"
319 .\" .RE
320 .B "pthread_setcanceltype"
321 ¤Ï¥¨¥é¡¼¤ÎºÝ¤Ë¼¡¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÖ¤¹:
322 .RS
323 .TP
324 .B "EINVAL"
325 .I "type"
326 °ú¿ô¤¬
327 .B "PTHREAD_CANCEL_DEFERRED"
328 ¤Ç¤â
329 .B "PTHREAD_CANCEL_ASYNCHRONOUS"
330 ¤Ç¤â¤Ê¤¤¡£
331 .RE
332
333 .\" .SH AUTHOR
334 .\" Xavier Leroy <Xavier.Leroy@inria.fr>
335 .\"
336 .\" .SH "SEE ALSO"
337 .\" .BR "pthread_exit" (3),
338 .\" .BR "pthread_cleanup_push" (3),
339 .\" .BR "pthread_cleanup_pop" (3).
340 .SH Ãø¼Ô
341 Xavier Leroy <Xavier.Leroy@inria.fr>
342
343 .SH ´ØÏ¢¹àÌÜ
344 .BR "pthread_exit" (3),
345 .BR "pthread_cleanup_push" (3),
346 .BR "pthread_cleanup_pop" (3).
347
348 .\".SH BUGS
349 .SH ¥Ð¥°
350
351 .\" POSIX specifies that a number of system calls (basically, all
352 .\" system calls that may block, such as 
353 .\" .BR "read" (2),
354 .\" .BR "write" (2),
355 .\" .BR "wait" (2),
356 .\" etc.) and library functions that may call these system calls (e.g.
357 .\" .BR "fprintf" (3))
358 .\" are cancellation points.  LinuxThreads is not yet
359 .\" integrated enough with the C library to implement this, and thus none
360 .\" of the C library functions is a cancellation point.
361 POSIX ¤Ï°ìÏ¢¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë(´ðËÜŪ¤Ë¤Ï
362 .BR "read" (2),
363 .BR "write" (2),
364 .BR "wait" (2),
365 Åù¤Î¤è¤¦¤Ê¥Ö¥í¥Ã¥¯¤Î²ÄǽÀ­¤Î¤¢¤ëÁ´¤Æ¤Î´Ø¿ô)¤È¤½¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë
366 ¤ò¸Æ¤Ö¤è¤¦¤Ê¥é¥¤¥Ö¥é¥ê´Ø¿ô(Î㤨¤Ð
367 .BR "fprintf" (3))
368 ¤¬¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ç¤¢¤ë¤Èµ¬Äꤷ¤Æ¤¤¤ë¡£ LinuxThreads ¤Ï¤³¤ì¤ò¼ÂÁõ¤¹¤ë
369 ¤Ë¤Ï¡¢¤Þ¤À½½Ê¬¤Ë C ¥é¥¤¥Ö¥é¥ê¤ÈÅý¹ç¤µ¤ì¤Æ¤¤¤ë¤È¸À¤¨¤º¡¢
370 ½¾¤Ã¤Æ¤¤¤«¤Ê¤ë C ¥é¥¤¥Ö¥é¥ê¤Î´Ø¿ô¤â¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ç¤Ï¤Ê¤¤¡£
371
372 .\" For system calls at least, there is a workaround. Cancellation
373 .\" requests are transmitted to the target thread by sending it a
374 .\" signal. That signal will interrupt all blocking system calls, causing
375 .\" them to return immediately with the 
376 .\" .B "EINTR"
377 .\" error. So, checking for
378 .\" cancellation during a 
379 .\" .B "read"
380 .\" system call, for instance, can be
381 .\" achieved as follows:
382 ¾¯¤Ê¤¯¤È¤â¡¢¥·¥¹¥Æ¥à¥³¡¼¥ë¤ËÂФ·¤Æ¤Ï¤³¤ì¤ò²óÈò¤¹¤ëÊýË¡¤¬¤¢¤ë¡£
383 ¼è¤ê¾Ã¤·Í×µá¤Ï¡¢ÌÜɸ¥¹¥ì¥Ã¥É¤Ë¥·¥°¥Ê¥ë¤òÁ÷¤ë¤³¤È¤Ë¤è¤Ã¤ÆÁ÷¿®¤µ¤ì¤ë¡£
384 ¤³¤Î¥·¥°¥Ê¥ë¤Ï¥Ö¥í¥Ã¥¯¤·¤Æ¤¤¤ë¥·¥¹¥Æ¥à¥³¡¼¥ëÁ´¤Æ¤ËÂФ·¤Æ³ä¹þ¤ß¤ò³Ý¤±¡¢
385 ¤½¤ì¤é¤Ïľ¤Á¤Ë
386 .B "EINTR"
387 ¤ÇÌá¤ë¡£¤è¤Ã¤Æ¡¢Î㤨¤Ð
388 .B "read"
389 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò¸Æ¤ó¤Ç¤¤¤ë´Ö¤Ë¼è¤ê¾Ã¤·¤ò¥Á¥§¥Ã¥¯¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¤è¤¦¤Ë
390 ¤¹¤ì¤ÐÎɤ¤:
391
392 .RS
393 .ft 3
394 .nf
395 .sp
396 pthread_testcancel();
397 retcode = read(fd, buffer, length);
398 pthread_testcancel();
399 .ft
400 .LP
401 .RE
402 .fi
403
404
405 [ÌõÃí] ¾å¤Îµ­½Ò¤Ï glibc2 ¤òÍѤ¤¤¿¥·¥¹¥Æ¥à¤Ç¤ÏÀµ¤·¤¯¤Ê¤¤¡£°Ê²¼¤Ï 
406 glib-2.1.2 ¤Î info ¥Õ¥¡¥¤¥ë¤«¤é¤Î°úÍѤǤ¢¤ë¡£
407
408 .\"    Cancellation points are the points where the thread checks for
409 .\" pending cancellation requests and performs them.  The POSIX threads
410 .\" functions `pthread_join', `pthread_cond_wait',
411 .\" `pthread_cond_timedwait', `pthread_testcancel', `sem_wait', and
412 .\" `sigwait' are cancellation points.  In addition, these system calls are
413 .\" cancellation points:
414 .\"
415 .\" accept                   open                     sendmsg                  
416 .\" close                    pause                    sendto                   
417 .\" connect                  read                     system                   
418 .\" fcntl                    recv                     tcdrain                  
419 .\" fsync                    recvfrom                 wait                     
420 .\" lseek                    recvmsg                  waitpid                  
421 .\" msync                    send                     write                    
422 .\" nanosleep                                                                  
423 .\"
424 .\" All library functions that call these functions (such as `printf') are
425 .\"also cancellation points.
426 ¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤È¤Ï¡¢ÊÝαÃæ¤Î¼è¤ê¾Ã¤·Í×µá¤ËÂФ¹¤ë¥Æ¥¹¥È¤¬¹Ô¤ï¤ì¡¢
427 ¼ÂºÝ¤ËÍ׵᤬¤¢¤ì¤Ð¼è¤ê¾Ã¤·¤¬¼Â¹Ô¤µ¤ì¤ëÅÀ¤Ç¤¢¤ë¡£POSIX ¥¹¥ì¥Ã¥É´Ø¿ô
428 ¤Î¤¦¤Á¡¢`pthread_join', `pthread_cond_wait', `pthread_cond_timed_wait', 
429 `pthread_testcancel', `sem_wait' µÚ¤Ó `sigwait' ¤Ï¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È
430 ¤Ç¤¢¤ë¡£ ¤³¤ì¤Ë²Ã¤¨¤Æ¡¢°Ê²¼¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ç¤¢¤ë:
431
432  accept                   open                     sendmsg                  
433  close                    pause                    sendto                   
434  connect                  read                     system                   
435  fcntl                    recv                     tcdrain                  
436  fsync                    recvfrom                 wait                     
437  lseek                    recvmsg                  waitpid                  
438  msync                    send                     write                    
439  nanosleep                                                                  
440
441 ¤³¤ì¤é¤Î´Ø¿ô¤ò¸Æ¤Ó½Ð¤¹²ÄǽÀ­¤Î¤¢¤ë printf() ¤Ê¤É¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤â
442 ¼è¤ê¾Ã¤·¥Ý¥¤¥ó¥È¤Ë¤Ê¤ë¾ì¹ç¤¬¤¢¤ë¡£
443