MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_signals

Function check_signals

crates/vm/src/signal.rs:43–59  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

41#[cfg_attr(feature = "flame-it", flame)]
42#[inline(always)]
43pub fn check_signals(vm: &VirtualMachine) -> PyResult<()> {
44 if vm.signal_handlers.get().is_none() {
45 return Ok(());
46 }
47
48 // Read-only check first: avoids cache-line invalidation on every
49 // instruction when no signal is pending (the common case).
50 if !ANY_TRIGGERED.load(Ordering::Relaxed) {
51 return Ok(());
52 }
53 // Atomic RMW only when a signal is actually pending.
54 if !ANY_TRIGGERED.swap(false, Ordering::Acquire) {
55 return Ok(());
56 }
57
58 trigger_signals(vm)
59}
60
61#[inline(never)]
62#[cold]

Callers 5

signalFunction · 0.85
pauseFunction · 0.85
raise_signalFunction · 0.85
pthread_sigmaskFunction · 0.85
check_signalsMethod · 0.85

Calls 5

trigger_signalsFunction · 0.85
is_noneMethod · 0.45
getMethod · 0.45
loadMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected