pub struct StoppableHandle<T> { /* private fields */ }
Expand description
A handle for a stoppable thread
The interface is similar to std::thread::JoinHandle<T>
, supporting
thread
and join
with the same signature.
Implementations§
Source§impl<T> StoppableHandle<T>
impl<T> StoppableHandle<T>
pub fn thread(&self) -> &Thread
pub fn join(self) -> Result<T>
Sourcepub fn stop(self) -> JoinHandle<T>
pub fn stop(self) -> JoinHandle<T>
Stop the thread
This will signal the thread to stop by setting the shared atomic
stopped
variable to True
. The function will return immediately
after, to wait for the thread to stop, use the returned JoinHandle<T>
and wait()
.
Auto Trait Implementations§
impl<T> Freeze for StoppableHandle<T>
impl<T> !RefUnwindSafe for StoppableHandle<T>
impl<T> Send for StoppableHandle<T>
impl<T> Sync for StoppableHandle<T>
impl<T> Unpin for StoppableHandle<T>
impl<T> !UnwindSafe for StoppableHandle<T>
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