Struct rusty_pool::JoinHandle [−][src]
pub struct JoinHandle<T: Send> { /* fields omitted */ }
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.
Implementations
impl<T: Send> JoinHandle<T>
[src]
impl<T: Send> JoinHandle<T>
[src]pub fn try_await_complete(self) -> Result<T, Canceled>
[src]
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.
pub fn await_complete(self) -> T
[src]
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.