proc_thr_kill, proc_thr_sigqueue, proc_thr_sigqueue_wait - Send or queue a signal to a thread in a process.
#include <signal.h>
int proc_thr_kill(pid_t pid, pthread_t thread, int sig);
int proc_thr_sigqueue(pid_t pid, pthread_t thread, int sig, const union sigval value);
int proc_thr_sigqueue_wait(pid_t pid, pthread_t thread, int sig, const union sigval value, const struct timespec *timeout);
The proc_thr_kill() function sends the signal specified by sig to the thread specified by thread in the process specified by pid. The sig argument must be one of the signals listed in signal.h(3HEAD), with the exception of SIGCANCEL being reserved and off limits. If sig is 0, a validity check is performed for the existence of the target thread and no signal is sent.
The proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions cause the signal specified by sig to be sent with the value specified by value to the thread specified by thread in the process specified by pid. The sig argument must be one of the signals listed in siginfo.h(3HEAD), with the exception of SIGCANCEL being reserved and off limits. If sig is 0, a validity check is performed for the existence of the target thread and no signal is sent.
The proc_thr_sigqueue() function returns immediately, possibly failing with an error EAGAIN. In contrast, proc_thr_sigqueue_wait() will wait for resources to become available to queue the signal if the caller's process already has the maximum number of queued signals allowed per process pending. If the timeout argument is not NULL, proc_thr_sigqueue_wait() will wait up to the specified time interval for the necessary resources to become available. If the timeout argument is NULL, proc_thr_sigqueue_wait() will wait as long as necessary.
For the proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions, if SA_SIGINFO is set for sig in the target process and if the resources are available to queue the signal, the signal is queued and sent to the target thread. If SA_SIGINFO is not set for sig in the target process, then sig is sent at least once to the target thread. It is not specified whether value will be sent to the target thread as a result of this call.
Upon successful completion of proc_thr_kill(), proc_thr_sigqueue(), or proc_thr_sigqueue_wait(), the specified signal will be sent, and the function returns 0. Otherwise, no signal is sent and the function returns an error number. It is not an error for the target thread to be a zombie thread.
The proc_thr_kill(), proc_thr_sigqueue(), proc_thr_sigqueue_wait() functions fail if:
The value of pid is zero or negative. The value of sig is an invalid or unsupported signal number.
The target process or the target thread does not exist.
The proc_thr_sigqueue() and proc_thr_sigqueue_wait() functions fail if:
No resources are available to queue the signal within the specified time interval. The process has already queued its maximum number of signals that are still pending at the receiver(s), or a system wide resource limit has been exceeded. The maximum number of outstanding queued signals that a process can have is defined by its process.max-sigqueue-size resource control.
The proc_thr_sigqueue_wait() function will fail if:
The timeout argument is not NULL and is an invalid address.
The timeout argument specifies an invalid time.
The function is interrupted while waiting.
See attributes(5) for descriptions of the following attributes:
|
kill(2), pthread_kill(3C), pthread_sigmask(3C), pthread_sigqueue (3C) , sigqueue(3C), siginfo.h(3HEAD), signal.h(3HEAD), attributes(5), resource-controls(5)