1 .\" Copyright (C) 2004 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"*******************************************************************
25 .\" This file was generated with po4a. Translate the source file.
27 .\"*******************************************************************
28 .TH SET_TID_ADDRESS 2 2004\-09\-10 Linux "Linux Programmer's Manual"
30 set_tid_address \- スレッド ID へのポインタを設定する
33 \fB#include <linux/unistd.h>\fP
35 \fBlong set_tid_address(int *\fP\fItidptr\fP\fB);\fP
38 カーネルは各プロセスについて \fIset_child_tid\fP と \fIclear_child_tid\fP という 2 つの値を保持する。
41 プロセスが \fBCLONE_CHILD_SETTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、
42 \fIset_child_tid\fP は \fIchild_tidptr\fP に設定される。 これは \fBclone\fP(2) のシステムコールの 5
45 \fIset_child_tid\fP が設定された場合、一番最初に新しいプロセスが行うことは、 このアドレスに自身の PID を書き込むことである。
47 プロセスが \fBCLONE_CHILD_CLEARTID\fP フラグを指定した \fBclone\fP(2) によって開始された場合、
48 \fIclear_child_tid\fP は \fIchild_tidptr\fP に設定される。 これは \fBclone\fP(2) のシステムコールの 5
51 システムコール \fBset_tid_address\fP() は呼び出し元プロセスの \fIclear_child_tid\fP の値を \fItidptr\fP
54 \fIclear_child_tid\fP が設定されているときにプロセスが終了すると、 そのプロセスは他のプロセスまたはスレッドとメモリを共有しているので、
55 このアドレスに 0 が書き込まれ、 \fIfutex(child_tidptr, FUTEX_WAKE, 1, NULL, NULL, 0);\fP
56 の呼び出しが実行される (つまり、この futex で待っている 1 つのプロセスを起こす (wake))。 エラーは無視される。
58 \fBset_tid_address\fP() は常に現在のプロセスの PID を返す。
60 \fBset_tid_address\fP() は常に成功する。
62 この呼び出しは Linux 2.5.48 以降で存在する。 ここで書かれた詳細は Linux 2.5.49 以降で有効である。
64 このシステムコールは Linux 固有である。
66 \fBclone\fP(2), \fBfutex\fP(2)