2 .\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH pthread_kill 3 (date) "Linux man-pages (unreleased)"
9 pthread_kill \- send a signal to a thread
12 .RI ( libpthread ", " \-lpthread )
15 .B #include <signal.h>
17 .BI "int pthread_kill(pthread_t " thread ", int " sig );
21 Feature Test Macro Requirements for glibc (see
22 .BR feature_test_macros (7)):
27 _POSIX_C_SOURCE >= 199506L || _XOPEN_SOURCE >= 500
32 function sends the signal
36 a thread in the same process as the caller.
37 The signal is asynchronously directed to
42 is 0, then no signal is sent, but error checking is still performed.
47 on error, it returns an error number, and no signal is sent.
51 An invalid signal was specified.
53 For an explanation of the terms used in this section, see
59 Interface Attribute Value
64 T} Thread safety MT-Safe
67 The glibc implementation of
71 on attempts to send either of the real-time signals
72 used internally by the NPTL threading implementation.
77 POSIX.1-2008 recommends that if an implementation detects the use
78 of a thread ID after the end of its lifetime,
80 should return the error
82 The glibc implementation returns this error in the cases where
83 an invalid thread ID can be detected.
84 But note also that POSIX says that an attempt to use a thread ID whose
85 lifetime has ended produces undefined behavior,
86 and an attempt to use an invalid thread ID in a call to
88 can, for example, cause a segmentation fault.
94 Signal dispositions are process-wide:
95 if a signal handler is installed,
96 the handler will be invoked in the thread
98 but if the disposition of the signal is "stop", "continue", or "terminate",
99 this action will affect the whole process.
104 .BR pthread_self (3),
105 .BR pthread_sigmask (3),