pub struct InterruptibleEvent { /* private fields */ }Expand description
A blocking object that can either be notified normally or interrupted
To block using an InterruptibleEvent, first call begin_wait. At this point, the event is
in the “waiting” state, and future calls to notify or interrupt will terminate the wait.
After begin_wait returns, call block_until to block the current thread until one of the
following conditions occur:
- The given deadline expires.
- At least one of the
notifyorinterruptfunctions were called afterbegin_wait.
It’s safe to call notify or interrupt at any time. However, calls to begin_wait and
block_until must alternate, starting with begin_wait.
InterruptibleEvent uses two-phase waiting so that clients can register for notification,
perform some related work, and then start blocking. This approach ensures that clients do not
miss notifications that arrive after they perform the related work but before they actually
start blocking.
Implementations§
Source§impl InterruptibleEvent
impl InterruptibleEvent
pub fn new() -> Arc<Self>
Sourcepub fn begin_wait<'a>(self: &'a Arc<Self>) -> EventWaitGuard<'a>
pub fn begin_wait<'a>(self: &'a Arc<Self>) -> EventWaitGuard<'a>
Called to initiate a wait.
Calls to notify or interrupt after this function returns will cause the event to wake
up. Calls to those functions prior to calling begin_wait will be ignored.
Once called, this function cannot be called again until block_until returns. Otherwise,
this function will panic.
Trait Implementations§
Source§impl Debug for InterruptibleEvent
impl Debug for InterruptibleEvent
Auto Trait Implementations§
impl !Freeze for InterruptibleEvent
impl RefUnwindSafe for InterruptibleEvent
impl Send for InterruptibleEvent
impl Sync for InterruptibleEvent
impl Unpin for InterruptibleEvent
impl UnsafeUnpin for InterruptibleEvent
impl UnwindSafe for InterruptibleEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more