Check pending unblocked signals before blocking.
This is not a perfect solution, since the kernel technically already has all the information it needs to synchronize this between the kill() invocation and the time WaitCondition::wait is called, but it should not have any noticeable performance impact.
This commit is contained in:
@@ -48,6 +48,9 @@ impl WaitCondition {
|
||||
|
||||
{
|
||||
let mut context = context_lock.write();
|
||||
if let Some((control, _, _)) = context.sigcontrol() && control.currently_pending_unblocked() != 0 {
|
||||
return false;
|
||||
}
|
||||
id = context.id;
|
||||
context.block(reason);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user