pub fn wait_for_single_object(
object: impl AsHandle,
timeout: Option<Duration>,
) -> Result<WaitOutcome>Expand description
Wait for object to be signalled, for up to timeout: None is no limit, and Duration::ZERO
only asks whether it is signalled now.
A satisfied wait changes the object, as the Win32 call does: it resets an auto-reset event,
acquires a mutex and decrements a semaphore. The wait is not alertable, so a queued APC does
not end it; wait_for_single_object_ex is the one an APC can end.
A timeout is rounded up to whole milliseconds, so a wait for a nonzero time is never a poll.
ยงErrors
io::ErrorKind::InvalidInput for a timeout the call cannot express: INFINITE is u32::MAX
milliseconds, so the longest finite wait is one millisecond less, about 49.7 days. It is refused
rather than shortened, since a wait that ends early has given a wrong answer. Otherwise the
error from GetLastError when the wait fails, such as access denied for a handle without
SYNCHRONIZE access.