pub struct Group { /* private fields */ }
Expand description
A Grand Central Dispatch group.
A Group
is a mechanism for grouping closures and monitoring them. This
allows for aggregate synchronization, so you can track when all the
closures complete, even if they are running on different queues.
Implementations§
source§impl Group
impl Group
sourcepub fn enter(&self) -> GroupGuard
pub fn enter(&self) -> GroupGuard
Indicates that a closure has entered self, and increments the current
count of outstanding tasks. Returns a GroupGuard
that should be
dropped when the closure leaves self, decrementing the count.
sourcepub fn exec_async<F>(&self, queue: &Queue, work: F)where
F: 'static + Send + FnOnce(),
pub fn exec_async<F>(&self, queue: &Queue, work: F)where F: 'static + Send + FnOnce(),
Submits a closure asynchronously to the given Queue
and associates it
with self.
sourcepub fn notify<F>(&self, queue: &Queue, work: F)where
F: 'static + Send + FnOnce(),
pub fn notify<F>(&self, queue: &Queue, work: F)where F: 'static + Send + FnOnce(),
Schedules a closure to be submitted to the given Queue
when all tasks
associated with self have completed.
If self is empty, the closure is submitted immediately.
sourcepub fn wait_timeout(&self, timeout: Duration) -> Result<(), WaitTimeout>
pub fn wait_timeout(&self, timeout: Duration) -> Result<(), WaitTimeout>
Waits for all tasks associated with self to complete within the specified duration. Returns true if the tasks completed or false if the timeout elapsed.