OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man3 / pthread_cleanup_push_defer_np.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\"*******************************************************************
27 .\"
28 .\" This file was generated with po4a. Translate the source file.
29 .\"
30 .\"*******************************************************************
31 .\"
32 .\" Japanese Version Copyright (c) 2012  Akihiro MOTOKI
33 .\"         all rights reserved.
34 .\" Translated 2012-06-04, Akihiro MOTOKI <amotoki@gmail.com>
35 .\"
36 .TH PTHREAD_CLEANUP_PUSH_DEFER_NP 3 2014\-05\-28 Linux "Linux Programmer's Manual"
37 .SH 名前
38 pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np \-
39 cancelability type を保持したままでスレッドのキャンセルクリーンアップハンドラーの push/pop を行う
40 .SH 書式
41 .nf
42 \fB#include <pthread.h>\fP
43
44 \fBvoid pthread_cleanup_push_defer_np(void (*\fP\fIroutine\fP\fB)(void *),\fP
45 \fB                                   void *\fP\fIarg\fP\fB);\fP
46 \fBvoid pthread_cleanup_pop_restore_np(int \fP\fIexecute\fP\fB);\fP
47 .fi
48 .sp
49 \fI\-pthread\fP を付けてコンパイルとリンクを行う。
50 .sp
51 .in -4n
52 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
53 .in
54 .sp
55 .ad l
56 \fBpthread_cleanup_push_defer_np\fP(), \fBpthread_cleanup_pop_defer_np\fP():
57 .RS 4
58 _GNU_SOURCE
59 .RE
60 .ad
61 .SH 説明
62 これらの関数は \fBpthread_cleanup_push\fP(3) と \fBpthread_cleanup_pop\fP(3)
63 と同じだが、このページで説明する点が異なる。
64
65 \fBpthread_cleanup_push\fP(3) と同様に、
66 \fBpthread_cleanup_push_defer_np\fP() は \fIroutine\fP をそのスレッドの
67 クリーンアップハンドラーのスタックに追加する。これに加えて、
68 \fBpthread_cleanup_push_defer_np\fP() は現在の cancelability type も
69 保存し、cancelability type は "deferred" に設定する
70 (\fBpthread_setcanceltype\fP(3) 参照)。
71 これにより、この関数が呼び出される前のスレッドの cancelability type が
72 "asynchronous" であったとしても、キャンセルクリーンアップが行われること
73 が保証される。
74
75 \fBpthread_cleanup_pop\fP(3) と同様に、
76 \fBpthread_cleanup_pop_restore_np\fP() はそのスレッドのキャンセル
77 クリーンアップハンドラーのスタックから一番上にあるクリーンアップハンドラー
78 を取り出す。これに加えて、そのスレッドの cancelability type を、対応
79 する \fBpthread_cleanup_push_defer_np\fP() が呼ばれた時点の値に戻す。
80
81 呼び出し側では、これらの関数の呼び出しが同じ関数の中で対となり、かつ
82 文法的に同じネストレベル (nesting level) になることを保証しなければ
83 ならない。 \fBpthread_cleanup_push\fP(3) で説明されている他の制限も
84 適用される。
85
86 以下の一連の呼び出し
87
88 .in +4n
89 .nf
90 pthread_cleanup_push_defer_np(routine, arg);
91 pthread_cleanup_pop_restore_np(execute);
92 .fi
93 .in
94
95 と以下は等価である (但し、上の方がより簡潔で効率的である)。
96
97 .\" As far as I can see, LinuxThreads reverses the two substeps
98 .\" in the push and pop below.
99 .in +4n
100 .nf
101 int oldtype;
102
103 pthread_cleanup_push(routine, arg);
104 pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);
105 \&...
106 pthread_setcanceltype(oldtype, NULL);
107 pthread_cleanup_pop(execute);
108 .fi
109 .in
110 .\" SH VERSIONS
111 .\" Available since glibc 2.0
112 .SH 準拠
113 これらの関数は非標準の GNU による拡張である。
114 そのため、名前に "_np" (nonportable; 移植性がない) という接尾辞が
115 付いている。
116 .SH 関連項目
117 \fBpthread_cancel\fP(3), \fBpthread_cleanup_push\fP(3),
118 \fBpthread_setcancelstate\fP(3), \fBpthread_testcancel\fP(3), \fBpthreads\fP(7)
119 .SH この文書について
120 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
121 である。プロジェクトの説明とバグ報告に関する情報は
122 http://www.kernel.org/doc/man\-pages/ に書かれている。