SET_TID_ADDRESS(2) | Linux Programmer's Manual | SET_TID_ADDRESS(2) |
名前
set_tid_address -スレッド ID へのポインタを設定する書式
#include <linux/unistd.h>
long set_tid_address(int * tidptr );
説明
各プロセスについて、カーネルは set_child_tid と clear_child_tid という 2 つの属性を保持する。この 2 つの属性はデフォルトでは NULL である。- set_child_tid
- プロセスが CLONE_CHILD_SETTID フラグを指定した clone(2) によって開始された場合、 set_child_tid は clone(2) のシステムコールの ctid 引き数で渡された値に設定される。
- set_child_tid が設定された場合、一番最初に新しいプロセスが行うことは、このアドレスに自身の PID を書き込むことである。
- clear_child_tid
- プロセスが CLONE_CHILD_CLEARTID フラグを指定した clone(2) によって開始された場合、 clear_child_tid は clone(2) のシステムコールの ctid 引き数で渡された値に設定される。
システムコール set_tid_address() は呼び出し元プロセスの clear_child_tid の値を tidptr に設定する。
When a process whose clear_child_tid is not NULL terminates, then, if the process is sharing memory with other processes or threads, then 0 is written at the address specified in clear_child_tid and the kernel performs the following operation:
futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0);
The effect of this operation is to wake a single process that is performing a futex wait on the memory location. Errors from the futex wake operation are ignored.
返り値
set_tid_address() は常に現在のプロセスの PID を返す。エラー
set_tid_address() は常に成功する。バージョン
この呼び出しは Linux 2.5.48 以降で存在する。ここで書かれた詳細は Linux 2.5.49 以降で有効である。準拠
このシステムコールは Linux 固有である。関連項目
clone(2), futex(2)この文書について
この man ページは Linux man-pages プロジェクトのリリース 3.51 の一部である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man-pages/ に書かれている。2012-07-19 | Linux |