Struct humthreads::Thread
source · [−]pub struct Thread<T: Send + 'static> { /* private fields */ }
Expand description
Handle on a thread returned by Builder::spawn
.
Implementations
sourceimpl<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>where
U: Send + 'static,
F: FnMut(T) -> U + 'static,
pub fn map<U, F>(self, f: F) -> MapThread<U>where
U: Send + 'static,
F: FnMut(T) -> U + 'static,
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> !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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more