pub struct Thread<T: Send + 'static> { /* private fields */ }
Expand description
Handle on a thread returned by Builder::spawn
.
Implementations§
Source§impl<T: Send + 'static> Thread<T>
impl<T: Send + 'static> Thread<T>
Sourcepub fn join_timeout(&self, timeout: Duration) -> Result<T>
pub fn join_timeout(&self, timeout: Duration) -> Result<T>
Similar to Thread::join
but does not block forever.
Sourcepub fn map<U, F>(self, f: F) -> MapThread<U>
pub fn map<U, F>(self, f: F) -> MapThread<U>
Apply a transformation function when joining to the thread.
Sourcepub fn request_shutdown(&self)
pub fn request_shutdown(&self)
Signal the thread is should terminate as soon as possible.
NOTE: you should take precautions when implementing the thread body to periodiaclly check if it needs to terminate or not.
Sourcepub fn select_add<'a>(&'a self, select: &mut Select<'a>) -> usize
pub fn select_add<'a>(&'a self, select: &mut Select<'a>) -> usize
Add the thread to a Select
set.
Sourcepub fn select_join(&self, operation: SelectedOperation<'_>) -> Result<T>
pub fn select_join(&self, operation: SelectedOperation<'_>) -> Result<T>
Completes a join operation that was started by the Select
interface.
This method should be used if one of the select
operations are used.
If the ready
familiy of methods is used, use one of the other join methods.
Auto Trait Implementations§
impl<T> !Freeze for Thread<T>
impl<T> !RefUnwindSafe for Thread<T>
impl<T> Send for Thread<T>
impl<T> !Sync for Thread<T>
impl<T> Unpin for Thread<T>
impl<T> !UnwindSafe for Thread<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