sigtd(): prefer non-stopped thread as a target for signal queue
This should improve signal delivery latency and better expose the process state to the executing threads. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41128
This commit is contained in:
+5
-1
@@ -2157,14 +2157,18 @@ sigtd(struct proc *p, int sig, bool fast_sigblock)
|
||||
if (curproc == p && !SIGISMEMBER(curthread->td_sigmask, sig) &&
|
||||
(!fast_sigblock || curthread->td_sigblock_val == 0))
|
||||
return (curthread);
|
||||
|
||||
/* Find a non-stopped thread that does not mask the signal. */
|
||||
signal_td = NULL;
|
||||
FOREACH_THREAD_IN_PROC(p, td) {
|
||||
if (!SIGISMEMBER(td->td_sigmask, sig) && (!fast_sigblock ||
|
||||
td != curthread || td->td_sigblock_val == 0)) {
|
||||
td != curthread || td->td_sigblock_val == 0) &&
|
||||
(td->td_flags & TDF_BOUNDARY) == 0) {
|
||||
signal_td = td;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Select random (first) thread if no better match was found. */
|
||||
if (signal_td == NULL)
|
||||
signal_td = FIRST_THREAD_IN_PROC(p);
|
||||
return (signal_td);
|
||||
|
||||
Reference in New Issue
Block a user