A group is a group of operations dispatched on queues. More...
#include <xdispatch/group.h>
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 t=DISPATCH_TIME_FOREVER) |
Waits until the given time has passed or all dispatched operations in the group were executed. | |
bool | wait (struct tm *timeout) |
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 dispatch_object_t | native () const |
dispatch_group_t | native_group () const |
group & | operator= (const group &) |
virtual void | resume () |
Resumes the invocation of operations or blocks assigned to the object. | |
virtual void | suspend () |
Suspends the invocation of operations or blocks assigned to the object. | |
virtual void | target_queue (const queue &) |
Sets the target queue of this object, i.e. | |
bool | operator== (const object &) |
bool | operator== (const dispatch_object_t &) |
bool | operator!= (const object &) |
bool | operator!= (const dispatch_object_t &) |
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
Creates a new group.
Creates a new group out of the existing dispatch_group_t.
xdispatch::group::group | ( | const group & | ) |
void xdispatch::group::async | ( | operation * | r, |
const queue & | q = global_queue() |
||
) |
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 |
void xdispatch::group::async | ( | dispatch_block_t | b, |
const queue & | q = global_queue() |
||
) | [inline] |
virtual dispatch_object_t xdispatch::group::native | ( | ) | const [virtual] |
Implements xdispatch::object.
void xdispatch::group::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.
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() |
||
) | [inline] |
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.
bool xdispatch::object::operator!= | ( | const object & | ) | [inherited] |
bool xdispatch::object::operator!= | ( | const dispatch_object_t & | ) | [inherited] |
bool xdispatch::object::operator== | ( | const object & | ) | [inherited] |
bool xdispatch::object::operator== | ( | const dispatch_object_t & | ) | [inherited] |
virtual void xdispatch::object::resume | ( | ) | [virtual, inherited] |
Resumes the invocation of operations or blocks assigned to the object.
Reimplemented in xdispatch::source, QDispatchQueue, and QDispatchGroup.
virtual void xdispatch::object::suspend | ( | ) | [virtual, inherited] |
Suspends the invocation of operations or blocks assigned to the object.
The object will be suspended as soon as the currently executed operation or block finished.
Reimplemented in xdispatch::source, QDispatchQueue, and QDispatchGroup.
virtual void xdispatch::object::target_queue | ( | const queue & | ) | [virtual, inherited] |
Sets the target queue of this object, i.e.
the queue all items concerning this object will be dispatched on in turn.
Reimplemented in xdispatch::source.
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 |
bool xdispatch::group::wait | ( | struct tm * | timeout | ) |
Waits until the given time has passed or all dispatched operations in the group were executed.
timeout | give a timeout here |