1TKILL(2) Linux Programmer's Manual TKILL(2)
2
3
4
6 tkill, tgkill - send a signal to a thread
7
9 int tkill(int tid, int sig);
10
11 int tgkill(int tgid, int tid, int sig);
12
14 tgkill() sends the signal sig to the thread with the thread ID tid in
15 the thread group tgid. (By contrast, kill(2) can only be used to send
16 a signal to a process (i.e., thread group) as a whole, and the signal
17 will be delivered to an arbitrary thread within that process.)
18
19 tkill() is an obsolete predecessor to tgkill(). It only allows the
20 target thread ID to be specified, which may result in the wrong thread
21 being signaled if a thread terminates and its thread ID is recycled.
22 Avoid using this system call.
23
24 If tgid is specified as -1, tgkill() is equivalent to tkill().
25
26 These are the raw system call interfaces, meant for internal thread
27 library use.
28
30 On success, zero is returned. On error, -1 is returned, and errno is
31 set appropriately.
32
34 EINVAL An invalid thread ID, thread group ID, or signal was specified.
35
36 EPERM Permission denied. For the required permissions, see kill(2).
37
38 ESRCH No process with the specified thread ID (and thread group ID)
39 exists.
40
42 tkill() is supported since Linux 2.4.19 / 2.5.4. tgkill() was added in
43 Linux 2.5.75.
44
46 tkill() and tgkill() are Linux-specific and should not be used in pro‐
47 grams that are intended to be portable.
48
50 See the description of CLONE_THREAD in clone(2) for an explanation of
51 thread groups.
52
53 Glibc does not provide wrappers for these system calls; call them using
54 syscall(2).
55
57 clone(2), gettid(2), kill(2)
58
60 This page is part of release 3.22 of the Linux man-pages project. A
61 description of the project, and information about reporting bugs, can
62 be found at http://www.kernel.org/doc/man-pages/.
63
64
65
66Linux 2008-10-01 TKILL(2)