powerpc-sf longjmp clobbering of val argument
[musl.git] / src / thread / pthread_kill.c
blob79ddb20978f7513f35789209d3d4b3be13df1a46
1 #include "pthread_impl.h"
2 #include "lock.h"
4 int pthread_kill(pthread_t t, int sig)
6 int r;
7 sigset_t set;
8 /* Block not just app signals, but internal ones too, since
9 * pthread_kill is used to implement pthread_cancel, which
10 * must be async-cancel-safe. */
11 __block_all_sigs(&set);
12 LOCK(t->killlock);
13 r = t->tid ? -__syscall(SYS_tkill, t->tid, sig)
14 : (sig+0U >= _NSIG ? EINVAL : 0);
15 UNLOCK(t->killlock);
16 __restore_sigs(&set);
17 return r;