.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright (C) 2008 Michael Kerrisk .\" and Copyright 2003 Abhijit Menon-Sen .\" .\" 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. .\" .\" 2004-05-31, added tgkill, ahu, aeb .\" 2008-01-15 mtk -- rewote DESCRIPTION .\" .\" Japanese Version Copyright (c) 2003 Akihiro MOTOKI, all rights reserved. .\" Translated 2003-03-05, Akihiro MOTOKI .\" Updated 2005-02-28, Akihiro MOTOKI .\" .TH TKILL 2 2008-10-01 "Linux" "Linux Programmer's Manual" .SH 名前 tkill, tgkill \- スレッドにシグナルを送る .SH 書式 .nf .BI "int tkill(int " tid ", int " sig ); .sp .BI "int tgkill(int " tgid ", int " tid ", int " sig ); .fi .SH 説明 .BR tgkill () はスレッド・グループ .I tgid に属するスレッド ID が .I tid のスレッドにシグナル .I sig を送る。 (これに対し、 .BR kill (2) は一つのプロセス (すなわち、スレッド・グループ) にまとめてシグナルを 送るのにだけ利用できる。 .BR kill (2) で送信されたシグナルはプロセス内の任意のスレッドに配送される。) .BR tkill () はもう使われなくなった .BR tgkill () の先祖である。 .BR tkill () ではシグナルの送り先のスレッド ID しか指定できない。 そのため、スレッドが終了して、そのスレッド ID が再利用される場合に、 意図しないスレッドにシグナルが送られる可能性がある。 このシステムコールの使用は避けること。 .I tgid に \-1 が指定された場合、 .BR tgkill () は .BR tkill () と等価である。 これらはシステムコールへの直接のインターフェースであり、 スレッド・ライブラリ内部での使用を意図したものである。 .SH 返り値 成功した場合、0 が返される。エラーが発生した場合、\-1 が返され、 \fIerrno\fP が適切に設定される。 .SH エラー .TP .B EINVAL 指定されたスレッド ID、スレッドグループ ID、シグナルが不正であった。 .TP .B EPERM 許可がなかった。どのような許可が必要かについては、 .BR kill (2) を参照のこと。 .TP .B ESRCH 指定されたスレッドID (とスレッド・グループID) を持つプロセスが存在しない。 .SH バージョン .BR tkill () は Linux 2.4.19 / 2.5.4 以降でサポートされ、 .BR tgkill () は Linux 2.5.75 で追加された。 .SH 準拠 .BR tkill () と .BR tgkill () は Linux 固有であり、 移植を想定したプログラムでは使用すべきではない。 .SH 注意 スレッド・グループの説明については .BR clone (2) の .B CLONE_THREAD の説明を参照のこと。 glibc はこれらのシステムコールに対するラッパー関数を提供していない。 .BR syscall (2) を使って呼び出すこと。 .SH 関連項目 .BR clone (2), .BR gettid (2), .BR kill (2)