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
13 Note: There are no glibc wrappers for these system calls; see NOTES.
14
16 tgkill() sends the signal sig to the thread with the thread ID tid in
17 the thread group tgid. (By contrast, kill(2) can be used to send a
18 signal only to a process (i.e., thread group) as a whole, and the sig‐
19 nal will be delivered to an arbitrary thread within that process.)
20
21 tkill() is an obsolete predecessor to tgkill(). It allows only the
22 target thread ID to be specified, which may result in the wrong thread
23 being signaled if a thread terminates and its thread ID is recycled.
24 Avoid using this system call.
25
26 If tgid is specified as -1, tgkill() is equivalent to tkill().
27
28 These are the raw system call interfaces, meant for internal thread
29 library use.
30
32 On success, zero is returned. On error, -1 is returned, and errno is
33 set appropriately.
34
36 EINVAL An invalid thread ID, thread group ID, or signal was specified.
37
38 EPERM Permission denied. For the required permissions, see kill(2).
39
40 ESRCH No process with the specified thread ID (and thread group ID)
41 exists.
42
44 tkill() is supported since Linux 2.4.19 / 2.5.4. tgkill() was added in
45 Linux 2.5.75.
46
48 tkill() and tgkill() are Linux-specific and should not be used in pro‐
49 grams that are intended to be portable.
50
52 See the description of CLONE_THREAD in clone(2) for an explanation of
53 thread groups.
54
55 Glibc does not provide wrappers for these system calls; call them using
56 syscall(2).
57
59 clone(2), gettid(2), kill(2), rt_sigqueueinfo(2)
60
62 This page is part of release 3.53 of the Linux man-pages project. A
63 description of the project, and information about reporting bugs, can
64 be found at http://www.kernel.org/doc/man-pages/.
65
66
67
68Linux 2012-07-13 TKILL(2)