446254b685721085ce893deb125d72393cedcc6d
[musl] / src / thread / pthread_kill.c
1 #include "pthread_impl.h"
2 #include "lock.h"
3
4 int pthread_kill(pthread_t t, int sig)
5 {
6         int r;
7         sigset_t set;
8         __block_app_sigs(&set);
9         LOCK(t->killlock);
10         r = t->tid ? -__syscall(SYS_tkill, t->tid, sig)
11                 : (sig+0U >= _NSIG ? EINVAL : 0);
12         UNLOCK(t->killlock);
13         __restore_sigs(&set);
14         return r;
15 }