pub struct Interrupt { /* private fields */ }Expand description
A handle to the process’s one Ctrl+C listener.
Cheap to clone and safe to hold, which is what Interrupt::cleanup_guard
is for.
Implementations§
Source§impl Interrupt
impl Interrupt
Sourcepub fn cleanup_guard(&self) -> CleanupGuard
pub fn cleanup_guard(&self) -> CleanupGuard
Claim the right to clean up, for as long as the returned guard lives.
Taken before the clone starts and released after its directory is gone, which is what makes the listener’s decision race-free: every instant a git child is running, this is held.
Sourcepub async fn fired(&self)
pub async fn fired(&self)
Resolve when the user asks to stop, immediately if they already have.
The check has to be here rather than left to changed. subscribe marks
the new receiver as having seen the current value, so a signal that
arrived before this call leaves changed waiting for a second one that
never comes. That is not a hypothetical window: it is the gap between
cleanup_guard and the select! that waits on this.
The other side – a signal arriving between subscribe and the poll –
needs no check of its own. Tokio’s changed_impl requests its
notification before it compares versions, which closes that window
already; a second look here would be redundant, and worse, it would hide
whether the first one is doing any work.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interrupt
impl RefUnwindSafe for Interrupt
impl Send for Interrupt
impl Sync for Interrupt
impl Unpin for Interrupt
impl UnsafeUnpin for Interrupt
impl UnwindSafe for Interrupt
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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