.\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl) .\" .\" %%%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) 2005 Yuichi SATO .\" all rights reserved. .\" Translated Wed Jan 26 07:21:01 JST 2005 .\" by Yuichi SATO .\" Updated 2013-05-06, Akihiro MOTOKI .\" .TH SET_TID_ADDRESS 2 2014\-07\-08 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 つの属性を保持する。この 2 つの属性はデフォルトでは NULL である。 .TP \fIset_child_tid\fP スレッドが \fBCLONE_CHILD_SETTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、 \fIset_child_tid\fP は \fBclone\fP(2) のシステムコールの \fIctid\fP 引き数で渡された値に設定される。 .IP \fIset_child_tid\fP が設定された場合、一番最初に新しいスレッドが行うことは、 このアドレスに自身のスレッド ID を書き込むことである。 .TP \fIclear_child_tid\fP スレッドが \fBCLONE_CHILD_CLEARTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、 \fIclear_child_tid\fP は \fBclone\fP(2) のシステムコールの \fIctid\fP 引き数で渡された値に設定される。 .LP システムコール \fBset_tid_address\fP() は呼び出し元スレッドの \fIclear_child_tid\fP の値を \fItidptr\fP に設定する。 .LP \fIclear_child_tid\fP が NULL でないスレッドが終了すると、そのスレッドが他のスレッドとメモリーを共有していれば、 \fIclear_child_tid\fP で指定されたアドレスに 0 が書き込まれ、カーネルは以下の処理を実行する。 futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0); この処理の結果、このメモリーアドレスに対する futex wait を実行しているスレッドを一つ起こす (wake)。 futex wake 操作でのエラーは無視される。 .SH 返り値 \fBset_tid_address\fP() は常に呼び出し元のスレッド ID を返す。 .SH エラー \fBset_tid_address\fP() は常に成功する。 .SH バージョン この呼び出しは Linux 2.5.48 以降で存在する。 ここで書かれた詳細は Linux 2.5.49 以降で有効である。 .SH 準拠 このシステムコールは Linux 固有である。 .SH 関連項目 \fBclone\fP(2), \fBfutex\fP(2), \fBgettid\fP(2) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。