Fix raise(3) so it works in signal handlers.
We could special-case raise(3) in non-threaded programs, but the more conservative course is to make pthread_kill(3) work in signal handlers at the cost of a race shared by other C libraries. Change-Id: I59fb23d03bdabf403435e731704b33acdf3e0234
This commit is contained in:
@@ -42,7 +42,11 @@ int pthread_kill(pthread_t t, int sig) {
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
int rc = tgkill(getpid(), thread->tid, sig);
|
||||
// There's a race here, but it's one we share with all other C libraries.
|
||||
pid_t tid = thread->tid;
|
||||
thread.Unlock();
|
||||
|
||||
int rc = tgkill(getpid(), tid, sig);
|
||||
if (rc == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
Reference in New Issue
Block a user