pub struct Closer { /* private fields */ }Available on crate feature
std only.Expand description
Closer holds the two things we need to close a thread and wait for it to finish: a chan to tell the thread to shut down, and a WaitGroup with which to wait for it to finish shutting down.
Implementations§
Source§impl Closer
impl Closer
Sourcepub fn add_running(&self, running: usize)
pub fn add_running(&self, running: usize)
Adds delta to the WaitGroup.
Sourcepub fn done(&self)
pub fn done(&self)
Calls WaitGroup::done on the WaitGroup.
Sourcepub fn wait(&self)
pub fn wait(&self)
Waits on the WaitGroup. (It waits for the Closer’s initial value, Closer::add_running, and Closer::done
calls to balance out.)
Sourcepub fn signal_and_wait(&self)
pub fn signal_and_wait(&self)
Calls Closer::signal, then Closer::wait.
Sourcepub fn listen(&self) -> Receiver<()>
pub fn listen(&self) -> Receiver<()>
Listens for the Closer::signal signal.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Closer
impl !RefUnwindSafe for Closer
impl Send for Closer
impl Sync for Closer
impl Unpin for Closer
impl !UnwindSafe for Closer
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
Mutably borrows from an owned value. Read more