File tree 1 file changed +6
-0
lines changed 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,10 @@ const SIG_ERR: libc::sighandler_t = !0;
26
26
// We cannot use the NSIG const in the arr macro. This will fail compilation if NSIG is different.
27
27
static TRIGGERS : [ AtomicBool ; NSIG ] = arr ! [ AtomicBool :: new( false ) ; 64 ] ;
28
28
29
+ static ANY_TRIGGERED : AtomicBool = AtomicBool :: new ( false ) ;
30
+
29
31
extern "C" fn run_signal ( signum : i32 ) {
32
+ ANY_TRIGGERED . store ( true , Ordering :: Relaxed ) ;
30
33
TRIGGERS [ signum as usize ] . store ( true , Ordering :: Relaxed ) ;
31
34
}
32
35
@@ -93,6 +96,9 @@ fn alarm(time: PyIntRef, _vm: &VirtualMachine) -> u32 {
93
96
}
94
97
95
98
pub fn check_signals ( vm : & VirtualMachine ) -> PyResult < ( ) > {
99
+ if !ANY_TRIGGERED . swap ( false , Ordering :: Relaxed ) {
100
+ return Ok ( ( ) ) ;
101
+ }
96
102
for ( signum, trigger) in TRIGGERS . iter ( ) . enumerate ( ) . skip ( 1 ) {
97
103
let triggerd = trigger. swap ( false , Ordering :: Relaxed ) ;
98
104
if triggerd {
You can’t perform that action at this time.
0 commit comments