pub fn signal_object_and_wait(
signal: impl Signalable,
wait: impl AsHandle,
timeout: Option<Duration>,
alertable: Alertable,
) -> Result<WaitOutcome>Expand description
Signal signal, then wait for wait, as one step with nothing able to happen between the two:
SignalObjectAndWait.
It is one call to the kernel where a set followed by a wait is two, which is what Microsoft
offers it for: a handshake between two threads without the context switch the second call can
cost.
signal is set if it is an event, released once if it is a semaphore, and released if it is a
mutex the calling thread owns. A wait that times out or is alerted has still signalled: the
signal is not undone. The outcomes are those of a wait on one object, with wait changed as
wait_for_single_object describes.
ยงErrors
io::ErrorKind::InvalidInput for a timeout the call cannot express, before anything is
signalled. Otherwise the error from GetLastError, and then nothing was waited on and the
signal may or may not have been sent: the call reports one failure for either half, so a
caller that needs to know checks the object. Access denied for a signal handle without the
right to modify it, or for a wait handle without SYNCHRONIZE; invalid handle for one that
is not an object the call can signal.