1 #include <unistd.h> 2 #include "pthread_impl.h" 3 #include "lock.h" 4 pthread_kill(pthread_t t,int sig)5int pthread_kill(pthread_t t, int sig) 6 { 7 int r; 8 sigset_t set; 9 /* Block not just app signals, but internal ones too, since 10 * pthread_kill is used to implement pthread_cancel, which 11 * must be async-cancel-safe. */ 12 __block_all_sigs(&set); 13 LOCK(t->killlock); 14 r = t->tid ? -__syscall(__NR_tgkill, getpid(), t->tid, sig) 15 : (sig+0U >= _NSIG ? EINVAL : 0); 16 UNLOCK(t->killlock); 17 __restore_sigs(&set); 18 return r; 19 } 20