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

Function WaitForSingleObject

crates/vm/src/stdlib/_winapi.rs:541–556  ·  view source on GitHub ↗
(h: WinHandle, ms: i64, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

539
540 #[pyfunction]
541 fn WaitForSingleObject(h: WinHandle, ms: i64, vm: &VirtualMachine) -> PyResult<u32> {
542 // Negative values (e.g., -1) map to INFINITE (0xFFFFFFFF)
543 let ms = if ms < 0 {
544 windows_sys::Win32::System::Threading::INFINITE
545 } else if ms > u32::MAX as i64 {
546 return Err(vm.new_overflow_error("timeout value is too large"));
547 } else {
548 ms as u32
549 };
550 let ret = unsafe { windows_sys::Win32::System::Threading::WaitForSingleObject(h.0, ms) };
551 if ret == windows_sys::Win32::Foundation::WAIT_FAILED {
552 Err(vm.new_last_os_error())
553 } else {
554 Ok(ret)
555 }
556 }
557
558 #[pyfunction]
559 fn WaitForMultipleObjects(

Callers 4

wait_eventFunction · 0.85
exec_queryFunction · 0.85
WriteFileFunction · 0.85

Calls 2

new_last_os_errorMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected