]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_kill.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / pthread_kill.3
CommitLineData
a1eaacb1 1'\" t
abb1d278
MK
2.\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
4.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
abb1d278 6.\"
4c1c5274 7.TH pthread_kill 3 (date) "Linux man-pages (unreleased)"
abb1d278
MK
8.SH NAME
9pthread_kill \- send a signal to a thread
29a94159
AC
10.SH LIBRARY
11POSIX threads library
8fc3b2cf 12.RI ( libpthread ", " \-lpthread )
abb1d278
MK
13.SH SYNOPSIS
14.nf
99878f27 15.B #include <signal.h>
dbfe9c70 16.PP
abb1d278
MK
17.BI "int pthread_kill(pthread_t " thread ", int " sig );
18.fi
68e4db0a 19.PP
d39ad78f 20.RS -4
d488abd6
MK
21Feature Test Macro Requirements for glibc (see
22.BR feature_test_macros (7)):
d39ad78f 23.RE
68e4db0a 24.PP
d488abd6 25.BR pthread_kill ():
9d2adbae 26.nf
5c10d2c5 27 _POSIX_C_SOURCE >= 199506L || _XOPEN_SOURCE >= 500
9d2adbae 28.fi
abb1d278
MK
29.SH DESCRIPTION
30The
31.BR pthread_kill ()
32function sends the signal
33.I sig
34to
35.IR thread ,
34ef249e 36a thread in the same process as the caller.
abb1d278
MK
37The signal is asynchronously directed to
38.IR thread .
847e0d88 39.PP
abb1d278
MK
40If
41.I sig
0566afc5 42is 0, then no signal is sent, but error checking is still performed.
abb1d278
MK
43.SH RETURN VALUE
44On success,
45.BR pthread_kill ()
46returns 0;
47on error, it returns an error number, and no signal is sent.
48.SH ERRORS
49.TP
27807c32
MK
50.B EINVAL
51An invalid signal was specified.
4e1cc645 52.SH ATTRIBUTES
e094b6cc
PH
53For an explanation of the terms used in this section, see
54.BR attributes (7).
55.TS
56allbox;
c466875e 57lbx lb lb
e094b6cc
PH
58l l l.
59Interface Attribute Value
60T{
9e54434e
BR
61.na
62.nh
4e1cc645 63.BR pthread_kill ()
e094b6cc
PH
64T} Thread safety MT-Safe
65.TE
c466875e 66.sp 1
4131356c 67.SH VERSIONS
4ea239b0
MK
68The glibc implementation of
69.BR pthread_kill ()
70gives an error
71.RB ( EINVAL )
72on attempts to send either of the real-time signals
73used internally by the NPTL threading implementation.
74See
75.BR nptl (7)
76for details.
847e0d88 77.PP
0566afc5
MK
78POSIX.1-2008 recommends that if an implementation detects the use
79of a thread ID after the end of its lifetime,
80.BR pthread_kill ()
81should return the error
82.BR ESRCH .
83The glibc implementation returns this error in the cases where
84an invalid thread ID can be detected.
85But note also that POSIX says that an attempt to use a thread ID whose
86lifetime has ended produces undefined behavior,
87and an attempt to use an invalid thread ID in a call to
88.BR pthread_kill ()
89can, for example, cause a segmentation fault.
4131356c
AC
90.SH STANDARDS
91POSIX.1-2008.
92.SH HISTORY
93POSIX.1-2001.
94.SH NOTES
95Signal dispositions are process-wide:
96if a signal handler is installed,
97the handler will be invoked in the thread
98.IR thread ,
99but if the disposition of the signal is "stop", "continue", or "terminate",
100this action will affect the whole process.
abb1d278 101.SH SEE ALSO
9c3f35c0 102.BR kill (2),
abb1d278
MK
103.BR sigaction (2),
104.BR sigpending (2),
105.BR pthread_self (3),
106.BR pthread_sigmask (3),
107.BR raise (3),
108.BR pthreads (7),
109.BR signal (7)