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 is no glibc wrapper for tkill(); 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
51 Library support for tgkill() was added to glibc in version 2.30.
52
54 tkill() and tgkill() are Linux-specific and should not be used in pro‐
55 grams that are intended to be portable.
56
58 See the description of CLONE_THREAD in clone(2) for an explanation of
59 thread groups.
60
61 Glibc does not provide a wrapper for tkill(); call it using syscall(2).
62 Before glibc 2.30, there was also no wrapper function for tgkill().
63
65 clone(2), gettid(2), kill(2), rt_sigqueueinfo(2)
66
68 This page is part of release 5.02 of the Linux man-pages project. A
69 description of the project, information about reporting bugs, and the
70 latest version of this page, can be found at
71 https://www.kernel.org/doc/man-pages/.
72
73
74
75Linux 2019-08-02 TKILL(2)