Skip to main content

WaitOnlyEvent

Struct WaitOnlyEvent 

Source
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

Source

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.

Trait Implementations§

Source§

impl AsHandle for WaitOnlyEvent

Source§

fn as_handle(&self) -> BorrowedHandle<'_>

Borrows the handle. Read more
Source§

impl AsRawHandle for WaitOnlyEvent

Source§

fn as_raw_handle(&self) -> RawHandle

Extracts the raw handle. Read more
Source§

impl Debug for WaitOnlyEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<WaitOnlyEvent> for OwnedHandle

Source§

fn from(event: WaitOnlyEvent) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.