pub struct WaitOnlyEvent { /* private fields */ }Expand description
A handle to an event that can wait on it and cannot set or reset it.
Made by Event::try_clone_wait_only, carrying SYNCHRONIZE access and no more. It is its own
type, not an Event that fails when set, because what it cannot do is not an error to be
discovered at run time: it has no set and no reset, and the kernel would refuse them if it
were handed to code that tried (WS-D-7).
What that guarantees: the handle cannot be used to signal the event, by this crate or by a
raw call, because the kernel refuses. What it does not: code that holds the handle can
duplicate it asking for more access, which Windows allows
(duplicate_handle_with_access), so this guards against
a handle used for what it was not handed out for, not against a holder bent on signalling.
It is still known to be an event, so what WS-D-4 lets a consumer
rely on holds here too: the handle is not a mutex, which is the one kind of object a thread-pool
wait cannot take. There is no way to adopt a handle as one, so that stays true without unsafe.
It lends its handle, so wait_for_single_object waits on it.
Send and Sync, as an event is.
Implementations§
Source§impl WaitOnlyEvent
impl WaitOnlyEvent
Sourcepub fn try_clone(&self) -> Result<Self>
pub fn try_clone(&self) -> Result<Self>
A second wait-only handle to the same event.
It holds the same access as this one, so the clone cannot signal either.
§Errors
Returns the error from DuplicateHandle; no test reaches it, as for
Event::try_clone.