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 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
41 EAGAIN The RLIMIT_SIGPENDING resource limit was reached and sig is a
42 real-time signal.
43
44 EAGAIN Insufficient kernel memory was available and sig is a real-time
45 signal.
46
48 tkill() is supported since Linux 2.4.19 / 2.5.4. tgkill() was added in
49 Linux 2.5.75.
50
52 tkill() and tgkill() are Linux-specific and should not be used in pro‐
53 grams that are intended to be portable.
54
56 See the description of CLONE_THREAD in clone(2) for an explanation of
57 thread groups.
58
59 Glibc does not provide wrappers for these system calls; call them using
60 syscall(2).
61
63 clone(2), gettid(2), kill(2), rt_sigqueueinfo(2)
64
66 This page is part of release 4.16 of the Linux man-pages project. A
67 description of the project, information about reporting bugs, and the
68 latest version of this page, can be found at
69 https://www.kernel.org/doc/man-pages/.
70
71
72
73Linux 2017-09-15 TKILL(2)