.\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl) .\" .\" 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. .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH SET_TID_ADDRESS 2 2004\-09\-10 Linux "Linux Programmer's Manual" .SH 名前 set_tid_address \- スレッド ID へのポインタを設定する .SH 書式 .nf \fB#include \fP .sp \fBlong set_tid_address(int *\fP\fItidptr\fP\fB);\fP .fi .SH 説明 カーネルは各プロセスについて \fIset_child_tid\fP と \fIclear_child_tid\fP という 2 つの値を保持する。 これらはデフォルトでは NULL である。 .SS set_child_tid プロセスが \fBCLONE_CHILD_SETTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、 \fIset_child_tid\fP は \fIchild_tidptr\fP に設定される。 これは \fBclone\fP(2) のシステムコールの 5 番目の引き数である。 .LP \fIset_child_tid\fP が設定された場合、一番最初に新しいプロセスが行うことは、 このアドレスに自身の PID を書き込むことである。 .SS clear_child_tid プロセスが \fBCLONE_CHILD_CLEARTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、 \fIclear_child_tid\fP は \fIchild_tidptr\fP に設定される。 これは \fBclone\fP(2) のシステムコールの 5 番目の引き数である。 .LP システムコール \fBset_tid_address\fP() は呼び出し元プロセスの \fIclear_child_tid\fP の値を \fItidptr\fP に設定する。 .LP \fIclear_child_tid\fP が設定されているときにプロセスが終了すると、 そのプロセスは他のプロセスまたはスレッドとメモリを共有しているので、 このアドレスに 0 が書き込まれ、 \fIfutex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);\fP の呼び出しが実行される (つまり、この futex で待っている 1 つのプロセスを起こす (wake))。 エラーは無視される。 .SH 返り値 \fBset_tid_address\fP() は常に現在のプロセスの PID を返す。 .SH エラー \fBset_tid_address\fP() は常に成功する。 .SH バージョン この呼び出しは Linux 2.5.48 以降で存在する。 ここで書かれた詳細は Linux 2.5.49 以降で有効である。 .SH 準拠 このシステムコールは Linux 固有である。 .SH 関連項目 \fBclone\fP(2), \fBfutex\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.41 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。