1PTHREAD_KILL(P) POSIX Programmer's Manual PTHREAD_KILL(P)
2
3
4
6 pthread_kill - send a signal to a thread
7
9 #include <signal.h>
10
11 int pthread_kill(pthread_t thread, int sig);
12
13
15 The pthread_kill() function shall request that a signal be delivered to
16 the specified thread.
17
18 As in kill(), if sig is zero, error checking shall be performed but no
19 signal shall actually be sent.
20
22 Upon successful completion, the function shall return a value of zero.
23 Otherwise, the function shall return an error number. If the
24 pthread_kill() function fails, no signal shall be sent.
25
27 The pthread_kill() function shall fail if:
28
29 ESRCH No thread could be found corresponding to that specified by the
30 given thread ID.
31
32 EINVAL The value of the sig argument is an invalid or unsupported sig‐
33 nal number.
34
35
36 The pthread_kill() function shall not return an error code of [EINTR].
37
38 The following sections are informative.
39
41 None.
42
44 The pthread_kill() function provides a mechanism for asynchronously
45 directing a signal at a thread in the calling process. This could be
46 used, for example, by one thread to affect broadcast delivery of a sig‐
47 nal to a set of threads.
48
49 Note that pthread_kill() only causes the signal to be handled in the
50 context of the given thread; the signal action (termination or stop‐
51 ping) affects the process as a whole.
52
54 None.
55
57 None.
58
60 kill() , pthread_self() , raise() , the Base Definitions volume of
61 IEEE Std 1003.1-2001, <signal.h>
62
64 Portions of this text are reprinted and reproduced in electronic form
65 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
66 -- Portable Operating System Interface (POSIX), The Open Group Base
67 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
68 Electrical and Electronics Engineers, Inc and The Open Group. In the
69 event of any discrepancy between this version and the original IEEE and
70 The Open Group Standard, the original IEEE and The Open Group Standard
71 is the referee document. The original Standard can be obtained online
72 at http://www.opengroup.org/unix/online.html .
73
74
75
76IEEE/The Open Group 2003 PTHREAD_KILL(P)