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