.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk .\" .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2012 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2012-06-04, Akihiro MOTOKI .\" .TH PTHREAD_CLEANUP_PUSH_DEFER_NP 3 2014\-05\-28 Linux "Linux Programmer's Manual" .SH 名前 pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np \- cancelability type を保持したままでスレッドのキャンセルクリーンアップハンドラーの push/pop を行う .SH 書式 .nf \fB#include \fP \fBvoid pthread_cleanup_push_defer_np(void (*\fP\fIroutine\fP\fB)(void *),\fP \fB void *\fP\fIarg\fP\fB);\fP \fBvoid pthread_cleanup_pop_restore_np(int \fP\fIexecute\fP\fB);\fP .fi .sp \fI\-pthread\fP を付けてコンパイルとリンクを行う。 .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp .ad l \fBpthread_cleanup_push_defer_np\fP(), \fBpthread_cleanup_pop_defer_np\fP(): .RS 4 _GNU_SOURCE .RE .ad .SH 説明 これらの関数は \fBpthread_cleanup_push\fP(3) と \fBpthread_cleanup_pop\fP(3) と同じだが、このページで説明する点が異なる。 \fBpthread_cleanup_push\fP(3) と同様に、 \fBpthread_cleanup_push_defer_np\fP() は \fIroutine\fP をそのスレッドの クリーンアップハンドラーのスタックに追加する。これに加えて、 \fBpthread_cleanup_push_defer_np\fP() は現在の cancelability type も 保存し、cancelability type は "deferred" に設定する (\fBpthread_setcanceltype\fP(3) 参照)。 これにより、この関数が呼び出される前のスレッドの cancelability type が "asynchronous" であったとしても、キャンセルクリーンアップが行われること が保証される。 \fBpthread_cleanup_pop\fP(3) と同様に、 \fBpthread_cleanup_pop_restore_np\fP() はそのスレッドのキャンセル クリーンアップハンドラーのスタックから一番上にあるクリーンアップハンドラー を取り出す。これに加えて、そのスレッドの cancelability type を、対応 する \fBpthread_cleanup_push_defer_np\fP() が呼ばれた時点の値に戻す。 呼び出し側では、これらの関数の呼び出しが同じ関数の中で対となり、かつ 文法的に同じネストレベル (nesting level) になることを保証しなければ ならない。 \fBpthread_cleanup_push\fP(3) で説明されている他の制限も 適用される。 以下の一連の呼び出し .in +4n .nf pthread_cleanup_push_defer_np(routine, arg); pthread_cleanup_pop_restore_np(execute); .fi .in と以下は等価である (但し、上の方がより簡潔で効率的である)。 .\" As far as I can see, LinuxThreads reverses the two substeps .\" in the push and pop below. .in +4n .nf int oldtype; pthread_cleanup_push(routine, arg); pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); \&... pthread_setcanceltype(oldtype, NULL); pthread_cleanup_pop(execute); .fi .in .\" SH VERSIONS .\" Available since glibc 2.0 .SH 準拠 これらの関数は非標準の GNU による拡張である。 そのため、名前に "_np" (nonportable; 移植性がない) という接尾辞が 付いている。 .SH 関連項目 \fBpthread_cancel\fP(3), \fBpthread_cleanup_push\fP(3), \fBpthread_setcancelstate\fP(3), \fBpthread_testcancel\fP(3), \fBpthreads\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。