@@ -27,6 +27,11 @@ __pthread_kill (pthread_t threadid, int signo)
if (__is_internal_signal (signo))
return EINVAL;
+ sigset_t set;
+ __libc_signal_block_all (&set);
+
+ int val;
+
/* Force load of pd->tid into local variable or register. Otherwise
if a thread exits between ESRCH test and tgkill, we might return
EINVAL, because pd->tid would be cleared by the kernel. */
@@ -34,13 +39,19 @@ __pthread_kill (pthread_t threadid, int signo)
pid_t tid = atomic_forced_read (pd->tid);
if (__glibc_unlikely (tid <= 0))
/* Not a valid thread handle. */
- return ESRCH;
+ val = ESRCH;
+ else
+ {
+ /* We have a special syscall to do the work. */
+ pid_t pid = __getpid ();
+
+ val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
+ val = (INTERNAL_SYSCALL_ERROR_P (val)
+ ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+ }
- /* We have a special syscall to do the work. */
- pid_t pid = __getpid ();
+ __libc_signal_restore_set (&set);
- int val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
- return (INTERNAL_SYSCALL_ERROR_P (val)
- ? INTERNAL_SYSCALL_ERRNO (val) : 0);
+ return val;
}
strong_alias (__pthread_kill, pthread_kill)