.\" 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-05-03, Akihiro MOTOKI .\" .TH PTHREAD_ATTR_SETDETACHSTATE 3 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 pthread_attr_setdetachstate, pthread_attr_getdetachstate \- スレッド属性オブジェクトの detach state 属性の設定/取得を行う .SH 書式 .nf \fB#include \fP .PP \fBint pthread_attr_setdetachstate(pthread_attr_t *\fP\fIattr\fP\fB, int \fP\fIdetachstate\fP\fB);\fP \fBint pthread_attr_getdetachstate(const pthread_attr_t *\fP\fIattr\fP\fB,\fP \fB int *\fP\fIdetachstate\fP\fB);\fP .PP \fI\-pthread\fP でコンパイルしてリンクする。 .fi .SH 説明 \fBpthread_attr_setdetachstate\fP() 関数は、 \fIattr\fP が参照するスレッド属性オブジェクトの detach state 属性を \fIdetachstate\fP で指定された値に設定する。 detach state 属性により、スレッド属性オブジェクト \fIattr\fP を使って 作成されるスレッドが、 join 可能な状態で作成されるか、 detached (切り離された) 状態で作成されるかが決定される。 .PP \fIdetachstate\fP には以下の値を指定できる。 .TP \fBPTHREAD_CREATE_DETACHED\fP \fIattr\fP を使って作成されるスレッドは detached 状態で作成される。 .TP \fBPTHREAD_CREATE_JOINABLE\fP \fIattr\fP を使って作成されるスレッドは join 可能な状態で作成される。 .PP 新規に初期化されたスレッド属性オブジェクトの detach state 属性の デフォルト設定は \fBPTHREAD_CREATE_JOINABLE\fP である。 .PP \fBpthread_attr_getdetachstate\fP() は、 スレッド属性オブジェクト \fIattr\fP の detach state 属性を \fIdetachstate\fP が指すバッファーに入れて返す。 .SH 返り値 成功すると、これらの関数は 0 を返す。 エラーの場合、0 以外のエラー番号を返す。 .SH エラー \fBpthread_attr_setdetachstate\fP() は以下のエラーで失敗する場合がある。 .TP \fBEINVAL\fP 無効な値が \fIdetachstate\fP で指定された。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lbw30 lb lb l l l. インターフェース 属性 値 T{ \fBpthread_attr_setdetachstate\fP(), \fBpthread_attr_getdetachstate\fP() T} Thread safety MT\-Safe .TE .SH 準拠 POSIX.1\-2001, POSIX.1\-2008. .SH 注意 detached 状態のスレッド、join 可能状態のスレッドの詳細については、 \fBpthread_create\fP(3) を参照。 .PP join 可能状態で作成されたスレッドは、最終的に \fBpthread_join\fP(3) を使って join するか、 \fBpthread_detach\fP(3) を使って切り離すか、 のどちらかを行うべきである。 .PP detached 状態で作成されたスレッドのスレッド ID を指定して、 \fBpthread_detach\fP(3) や \fBpthread_join\fP(3) を後から呼び出すのは エラーである。 .SH 例 \fBpthread_attr_init\fP(3) を参照。 .SH 関連項目 \fBpthread_attr_init\fP(3), \fBpthread_create\fP(3), \fBpthread_detach\fP(3), \fBpthread_join\fP(3), \fBpthreads\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。