Skip to main content

wait_for_any

Function wait_for_any 

Source
pub fn wait_for_any(
    objects: &[impl AsHandle],
    timeout: Option<Duration>,
    alertable: Alertable,
) -> Result<WaitAnyOutcome>
Expand description

Wait until any one of objects is signalled, for up to timeout: None is no limit and Duration::ZERO only asks. WaitForMultipleObjectsEx with bWaitAll false.

The objects are the borrowed handles of whatever the caller holds: a slice of &Event, of OwnedHandle, or of BorrowedHandle for a mixture, made with as_handle.

Only the signalled object reported has been changed by the wait: an auto-reset event is unsignalled again, a mutex owned, a semaphore’s count one lower. The others are as they were, signalled or not.

§Errors

io::ErrorKind::InvalidInput, without waiting, for no objects, for more than MAXIMUM_OBJECTS, or for a timeout the call cannot express (see wait_for_single_object). Otherwise the error from GetLastError when the wait fails, such as access denied for a handle without SYNCHRONIZE access, or invalid handle.