Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
winapi.WaitForSingleObject
  • Loading branch information
youknowone committed Jan 21, 2026
commit 2fb2a7eda85f6cd43ddc9d2a836f1b627014a369
10 changes: 9 additions & 1 deletion crates/vm/src/stdlib/winapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,15 @@ mod _winapi {
}

#[pyfunction]
fn WaitForSingleObject(h: WinHandle, ms: u32, vm: &VirtualMachine) -> PyResult<u32> {
fn WaitForSingleObject(h: WinHandle, ms: i64, vm: &VirtualMachine) -> PyResult<u32> {
// Negative values (e.g., -1) map to INFINITE (0xFFFFFFFF)
let ms = if ms < 0 {
windows_sys::Win32::System::Threading::INFINITE
} else if ms > u32::MAX as i64 {
return Err(vm.new_overflow_error("timeout value is too large".to_owned()));
} else {
ms as u32
};
let ret = unsafe { windows_sys::Win32::System::Threading::WaitForSingleObject(h.0, ms) };
if ret == windows_sys::Win32::Foundation::WAIT_FAILED {
Err(vm.new_last_os_error())
Expand Down