pub struct TaskFuture(/* private fields */);Expand description
A future that tracks completion of submitted tasks
TaskFuture provides both blocking and non-blocking ways to wait for
task completion. Tasks can be checked for completion, waited on
indefinitely, or waited on with a timeout.
TaskFuture is cheaply cloneable and can be shared across threads.
You can drop the future immediately after submission - tasks will
still complete as the task batch holds its own reference.
Implementations§
Source§impl TaskFuture
impl TaskFuture
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if all tasks are complete without blocking
Returns true if all tasks have finished execution.
This is a non-blocking operation using atomic loads.
Sourcepub fn wait(self)
pub fn wait(self)
Wait for all tasks to complete
First checks completion with an atomic load; if incomplete, it locks the mutex.
Sourcepub fn wait_timeout(self, timeout: Duration) -> bool
pub fn wait_timeout(self, timeout: Duration) -> bool
Wait for all tasks to complete with a timeout
First checks completion with an atomic load; if incomplete, it locks the mutex.
Returns true if all tasks completed within the timeout,
false if the timeout was reached first.
Trait Implementations§
Source§impl Clone for TaskFuture
impl Clone for TaskFuture
Source§fn clone(&self) -> TaskFuture
fn clone(&self) -> TaskFuture
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more