Struct rusty_pool::JoinHandle
source · [−]Expand description
Handle returned by ThreadPool::evaluate
and ThreadPool::complete
that allows to block the current thread and wait for the result of a submitted task. The returned JoinHandle
may also be sent to the ThreadPool
to create a task that blocks a worker thread until the task is completed and then does something with the result. This handle communicates with the worker thread
using a oneshot channel blocking the thread when try_await_complete()
is called until a message, i.e. the result of the
task, is received.
Fields
receiver: Receiver<T>
Implementations
sourceimpl<T: Send> JoinHandle<T>
impl<T: Send> JoinHandle<T>
sourcepub fn try_await_complete(self) -> Result<T, Canceled>
pub fn try_await_complete(self) -> Result<T, Canceled>
Block the current thread until the result of the task is received.
Errors
This function might return a oneshot::Canceled
if the channel was broken
before the result was received. This is generally the case if execution of
the task panicked.
sourcepub fn await_complete(self) -> T
pub fn await_complete(self) -> T
Block the current thread until the result of the task is received.
Panics
This function might panic if try_await_complete()
returns oneshot::Canceled
.
This is generally the case if execution of the task panicked and the sender was dropped before sending a result to the receiver.
Auto Trait Implementations
impl<T> !RefUnwindSafe for JoinHandle<T>
impl<T> Send for JoinHandle<T>
impl<T> Sync for JoinHandle<T>
impl<T> Unpin for JoinHandle<T>
impl<T> !UnwindSafe for JoinHandle<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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