Provides an interface for representing a dispatch queue and methods that can be called to modify or use the queue. More...
#include <xdispatch/queue.h>
Public Member Functions | |
queue (dispatch_queue_t) | |
Creates a new queue using the given dispatch_queue_t object. | |
queue (const char *label) | |
Creates a new serial queue featuring the given label. | |
queue (const std::string &) | |
queue (const queue &) | |
~queue () | |
void | async (operation *) |
Will dispatch the given operation for async execution on the queue and return immediately. | |
void | async (dispatch_block_t b) |
Same as async(operation*). | |
void | apply (iteration_operation *, size_t times) |
Applies the given iteration_operation for async execution in this queue and returns immediately. | |
void | apply (dispatch_iteration_block_t b, size_t times) |
Same as apply(iteration_operation*, size_t times). | |
void | after (operation *, struct tm *time) |
Applies the given operation for async execution in this queue after the given time and returns immediately. | |
void | after (operation *, dispatch_time_t time) |
void | after (dispatch_block_t b, struct tm *time) |
Same as dispatch_after(operation*, time_t). | |
void | after (dispatch_block_t b, dispatch_time_t time) |
void | sync (operation *) |
Applies the given operation for execution in this queue and blocks until the operation was executed. | |
void | sync (dispatch_block_t b) |
Same as dispatch_sync(operation*). | |
void | finalizer (operation *, const queue &=global_queue()) |
Sets the given operation as finalizer for this queue. | |
void | finalizer (dispatch_block_t b, const queue &q=global_queue()) |
Same as set_finalizer(operation*, queue*). | |
const std::string & | label () const |
virtual dispatch_object_t | native () const |
virtual dispatch_queue_t | native_queue () const |
queue & | operator= (const queue &) |
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 &) |
Provides an interface for representing a dispatch queue and methods that can be called to modify or use the queue.
Read Apple's documentation of libDispatch to understand the concept of tasks and queues.
Creates a new queue using the given dispatch_queue_t object.
xdispatch::queue::queue | ( | const char * | label | ) |
Creates a new serial queue featuring the given label.
xdispatch::queue::queue | ( | const std::string & | ) |
xdispatch::queue::queue | ( | const queue & | ) |
void xdispatch::queue::after | ( | operation * | , |
struct tm * | time | ||
) |
Applies the given operation for async execution in this queue after the given time and returns immediately.
The queue will take possession of the operation and handle the deletion. To change this behaviour, set the auto_delete flag of the operation.
time | The time to wait until the operation is applied to the queue. |
void xdispatch::queue::after | ( | operation * | , |
dispatch_time_t | time | ||
) |
void xdispatch::queue::after | ( | dispatch_block_t | b, |
struct tm * | time | ||
) | [inline] |
void xdispatch::queue::after | ( | dispatch_block_t | b, |
dispatch_time_t | time | ||
) | [inline] |
void xdispatch::queue::apply | ( | iteration_operation * | , |
size_t | times | ||
) |
Applies the given iteration_operation for async execution in this queue and returns immediately.
The operation will be deleted as soon as it was executed the requested number of times. To change this behaviour, set the auto_delete flag of the operation.
times | The number of times the operation will be executed |
void xdispatch::queue::apply | ( | dispatch_iteration_block_t | b, |
size_t | times | ||
) | [inline] |
Same as apply(iteration_operation*, size_t times).
Will wrap the given block in an operation and put it on the queue.
void xdispatch::queue::async | ( | operation * | ) |
Will dispatch the given operation for async execution on the queue and return immediately.
The operation will be deleted as soon as it was executed. To change this behaviour, set the auto_delete flag of the operation.
void xdispatch::queue::async | ( | dispatch_block_t | b | ) | [inline] |
void xdispatch::queue::finalizer | ( | operation * | , |
const queue & | = global_queue() |
||
) |
Sets the given operation as finalizer for this queue.
A finalizer is called before destroying a queue, i.e. if all queue objects representing the queue were deleted and all pending work on a queue was dispatched. The queue will take possession of the operation and handle the deletion. To change this behaviour, set the auto_delete flag of the operation.
When not passing a queue, the finalizer operation will be executed on the queue itself.
void xdispatch::queue::finalizer | ( | dispatch_block_t | b, |
const queue & | q = global_queue() |
||
) | [inline] |
const std::string& xdispatch::queue::label | ( | ) | const |
virtual dispatch_object_t xdispatch::queue::native | ( | ) | const [virtual] |
Implements xdispatch::object.
virtual dispatch_queue_t xdispatch::queue::native_queue | ( | ) | const [virtual] |
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.
void xdispatch::queue::sync | ( | operation * | ) |
Applies the given operation for execution in this queue and blocks until the operation was executed.
The queue will take possession of the operation and handle the deletion. To change this behaviour, set the auto_delete flag of the operation.
void xdispatch::queue::sync | ( | dispatch_block_t | b | ) | [inline] |
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.