File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,10 @@ const SIG_ERR: libc::sighandler_t = !0;
2626// We cannot use the NSIG const in the arr macro. This will fail compilation if NSIG is different.
2727static TRIGGERS : [ AtomicBool ; NSIG ] = arr ! [ AtomicBool :: new( false ) ; 64 ] ;
2828
29+ static ANY_TRIGGERED : AtomicBool = AtomicBool :: new ( false ) ;
30+
2931extern "C" fn run_signal ( signum : i32 ) {
32+ ANY_TRIGGERED . store ( true , Ordering :: Relaxed ) ;
3033 TRIGGERS [ signum as usize ] . store ( true , Ordering :: Relaxed ) ;
3134}
3235
@@ -93,6 +96,9 @@ fn alarm(time: PyIntRef, _vm: &VirtualMachine) -> u32 {
9396}
9497
9598pub fn check_signals ( vm : & VirtualMachine ) -> PyResult < ( ) > {
99+ if !ANY_TRIGGERED . swap ( false , Ordering :: Relaxed ) {
100+ return Ok ( ( ) ) ;
101+ }
96102 for ( signum, trigger) in TRIGGERS . iter ( ) . enumerate ( ) . skip ( 1 ) {
97103 let triggerd = trigger. swap ( false , Ordering :: Relaxed ) ;
98104 if triggerd {
You can’t perform that action at this time.
0 commit comments