blob: 9e94a7f0ee4908a8e9523a8e0922c59f7ef0d404 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* $OpenBSD: uthread_kill.c,v 1.9 2003/01/27 22:22:30 marc Exp $ */
/* PUBLIC_DOMAIN <marc@snafu.org> */
#include <errno.h>
#include <signal.h>
#ifdef _THREAD_SAFE
#include <pthread.h>
#include "pthread_private.h"
/*
* Validate the signal number and thread. If valid process the signal.
* ;;; need to fake up a siginfo_t and put it in the queue for this signal.
*/
int
pthread_kill(pthread_t pthread, int sig)
{
int ret;
if (sig >= 0 && sig < NSIG) {
ret = _find_thread(pthread);
if (sig != 0) {
if (_thread_sigact[sig - 1].sa_handler != SIG_IGN) {
if (pthread->state == PS_SIGWAIT &&
sigismember(pthread->data.sigwait, sig)) {
PTHREAD_NEW_STATE(pthread,PS_RUNNING);
pthread->signo = sig;
} else
_thread_signal(pthread,sig);
}
}
} else
ret = EINVAL;
return ret;
}
#endif
|