A group is a group of operations dispatched on queues. More...
Public Member Functions | |
group () | |
Creates a new group. | |
group (dispatch_group_t) | |
Creates a new group out of the existing dispatch_group_t. | |
group (const group &) | |
~group () | |
void | async (operation *r, const queue &q=global_queue()) |
Dispatches an operation on the given Queue. | |
void | async (dispatch_block_t b, const queue &q=global_queue()) |
Same as dispatch(operation* r, ...) Will wrap the given block in an operation and put it on the queue. | |
bool | wait (dispatch_time_t=DISPATCH_TIME_FOREVER) |
Waits until the given time has passed or all dispatched operations in the group were executed. | |
bool | wait (struct tm *t) |
Waits until the given time has passed or all dispatched operations in the group were executed. | |
void | notify (operation *r, const queue &q=global_queue()) |
This function schedules a notification operation to be submitted to the specified queue once all operations associated with the dispatch group have completed. | |
void | notify (dispatch_block_t b, const queue &q=global_queue()) |
This function schedules a notification block to be submitted to the specified queue once all blocks associated with the dispatch group have completed. | |
virtual void | suspend () |
Suspends the invocation of work items belonging to this group. | |
virtual void | resume () |
Resumes the invocation of work items belonging to this group. | |
dispatch_object_t | native () const |
group & | operator= (const group &) |
A group is a group of operations dispatched on queues.
This class provides a way to track all these operations and notify you if all of them finished executing.
See also Apple's Documentation of Dispatch Groups
xdispatch::group::group | ( | ) |
Creates a new group.
xdispatch::group::group | ( | dispatch_group_t | ) |
Creates a new group out of the existing dispatch_group_t.
xdispatch::group::group | ( | const group & | ) |
xdispatch::group::~group | ( | ) |
Dispatches an operation on the given Queue.
r | The operation to be dispatched |
q | The Queue to use. If no Queue is given, the system default queue will be used |
Reimplemented in QDispatchGroup.
void xdispatch::group::async | ( | dispatch_block_t | b, |
const queue & | q = global_queue() |
||
) |
Same as dispatch(operation* r, ...) Will wrap the given block in an operation and put it on the queue.
Reimplemented in QDispatchGroup.
dispatch_object_t xdispatch::group::native | ( | ) | const [virtual] |
Implements xdispatch::object.
This function schedules a notification operation to be submitted to the specified queue once all operations associated with the dispatch group have completed.
If no operations are associated with the dispatch group (i.e. the group is empty) then the notification operation will be submitted immediately.
The operation will be empty at the time the notification block is submitted to the target queue immediately. The group may either be deleted or reused for additional operations.
Reimplemented in QDispatchGroup.
void xdispatch::group::notify | ( | dispatch_block_t | b, |
const queue & | q = global_queue() |
||
) |
This function schedules a notification block to be submitted to the specified queue once all blocks associated with the dispatch group have completed.
If no blocks are associated with the dispatch group (i.e. the group is empty) then the notification block will be submitted immediately.
The group will be empty at the time the notification block is submitted to the target queue. The group may either be deleted or reused for additional operations.
Reimplemented in QDispatchGroup.
virtual void xdispatch::group::resume | ( | ) | [virtual] |
Resumes the invocation of work items belonging to this group.
Calls to suspend() must be balanced with calls to resume().
Implements xdispatch::object.
Reimplemented in QDispatchGroup.
virtual void xdispatch::group::suspend | ( | ) | [virtual] |
Suspends the invocation of work items belonging to this group.
A suspended group will not invoke any blocks associated with it. The suspension of a group will occur after any running work item associated with the group completes.
Calls to suspend() must be balanced with calls to resume().
Implements xdispatch::object.
Reimplemented in QDispatchGroup.
bool xdispatch::group::wait | ( | struct tm * | t | ) |
Waits until the given time has passed or all dispatched operations in the group were executed.
timeout | give a timeout here |
bool xdispatch::group::wait | ( | dispatch_time_t | = DISPATCH_TIME_FOREVER | ) |
Waits until the given time has passed or all dispatched operations in the group were executed.
t | give a time here or a DISPATCH_TIME_FOREVER to wait until all operations are done |