Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_kill(3) [minix man page]

PTHREAD_KILL(3)                                              Linux Programmer's Manual                                             PTHREAD_KILL(3)

pthread_kill - send a signal to a thread SYNOPSIS
#include <signal.h> int pthread_kill(pthread_t thread, int sig); Compile and link with -pthread. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): pthread_kill(): _POSIX_C_SOURCE >= 199506L || _XOPEN_SOURCE >= 500 DESCRIPTION
The pthread_kill() function sends the signal sig to thread, a thread in the same process as the caller. The signal is asynchronously directed to thread. If sig is 0, then no signal is sent, but error checking is still performed. RETURN VALUE
On success, pthread_kill() returns 0; on error, it returns an error number, and no signal is sent. ERRORS
EINVAL An invalid signal was specified. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +---------------+---------------+---------+ |Interface | Attribute | Value | +---------------+---------------+---------+ |pthread_kill() | Thread safety | MT-Safe | +---------------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. NOTES
Signal dispositions are process-wide: if a signal handler is installed, the handler will be invoked in the thread thread, but if the dispo- sition of the signal is "stop", "continue", or "terminate", this action will affect the whole process. The glibc implementation of pthread_kill() gives an error (EINVAL) on attempts to send either of the real-time signals used internally by the NPTL threading implementation. See nptl(7) for details. POSIX.1-2008 recommends that if an implementation detects the use of a thread ID after the end of its lifetime, pthread_kill() should return the error ESRCH. The glibc implementation returns this error in the cases where an invalid thread ID can be detected. But note also that POSIX says that an attempt to use a thread ID whose lifetime has ended produces undefined behavior, and an attempt to use an invalid thread ID in a call to pthread_kill() can, for example, cause a segmentation fault. SEE ALSO
kill(2), sigaction(2), sigpending(2), pthread_self(3), pthread_sigmask(3), raise(3), pthreads(7), signal(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at Linux 2017-09-15 PTHREAD_KILL(3)

Check Out this Related Man Page

PTHREAD_KILL(3P)					     POSIX Programmer's Manual						  PTHREAD_KILL(3P)

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
pthread_kill - send a signal to a thread SYNOPSIS
#include <signal.h> int pthread_kill(pthread_t thread, int sig); DESCRIPTION
The pthread_kill() function shall request that a signal be delivered to the specified thread. As in kill(), if sig is zero, error checking shall be performed but no signal shall actually be sent. RETURN VALUE
Upon successful completion, the function shall return a value of zero. Otherwise, the function shall return an error number. If the pthread_kill() function fails, no signal shall be sent. ERRORS
The pthread_kill() function shall fail if: ESRCH No thread could be found corresponding to that specified by the given thread ID. EINVAL The value of the sig argument is an invalid or unsupported signal number. The pthread_kill() function shall not return an error code of [EINTR]. The following sections are informative. EXAMPLES
The pthread_kill() function provides a mechanism for asynchronously directing a signal at a thread in the calling process. This could be used, for example, by one thread to affect broadcast delivery of a signal to a set of threads. Note that pthread_kill() only causes the signal to be handled in the context of the given thread; the signal action (termination or stop- ping) affects the process as a whole. RATIONALE
kill(), pthread_self(), raise(), the Base Definitions volume of IEEE Std 1003.1-2001, <signal.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at . IEEE
/The Open Group 2003 PTHREAD_KILL(3P)
Man Page

Featured Tech Videos