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

Method check_signals

crates/vm/src/vm/mod.rs:2018–2038  ·  view source on GitHub ↗

Checks for triggered signals and calls the appropriate handlers. A no-op on platforms where signals are not supported.

(&self)

Source from the content-addressed store, hash-verified

2016 /// Checks for triggered signals and calls the appropriate handlers. A no-op on
2017 /// platforms where signals are not supported.
2018 pub fn check_signals(&self) -> PyResult<()> {
2019 #[cfg(feature = "threading")]
2020 if self.state.finalizing.load(Ordering::Acquire) && !self.is_main_thread() {
2021 // once finalization starts,
2022 // non-main Python threads should stop running bytecode.
2023 return Err(self.new_exception(self.ctx.exceptions.system_exit.to_owned(), vec![]));
2024 }
2025
2026 // Suspend this thread if stop-the-world is in progress
2027 #[cfg(all(unix, feature = "threading"))]
2028 thread::suspend_if_needed(&self.state.stop_the_world);
2029
2030 #[cfg(not(target_arch = "wasm32"))]
2031 {
2032 crate::signal::check_signals(self)
2033 }
2034 #[cfg(target_arch = "wasm32")]
2035 {
2036 Ok(())
2037 }
2038 }
2039
2040 pub(crate) fn push_exception(&self, exc: Option<PyBaseExceptionRef>) {
2041 self.exceptions.borrow_mut().stack.push(exc);

Callers 15

sock_op_timeout_errMethod · 0.80
connect_innerMethod · 0.80
sendallMethod · 0.80
acquireMethod · 0.80
sem_timedwait_polledFunction · 0.80
handle_wait_errorFunction · 0.80
selectFunction · 0.80
pollMethod · 0.80
runMethod · 0.80
sleepFunction · 0.80
trap_eintrFunction · 0.80
flushMethod · 0.80

Calls 7

suspend_if_neededFunction · 0.85
check_signalsFunction · 0.85
is_main_threadMethod · 0.80
new_exceptionMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected