libXDispatch 0.6
Public Slots | Signals | Public Member Functions | Friends
QDispatchGroup Class Reference

A DispatchGroup is a group of QRunnables dispatched on queues. More...

Inheritance diagram for QDispatchGroup:

List of all members.

Public Slots

void resume ()
 Resumes the invocation of work items belonging to this group.
void suspend ()
 Suspends the invocation of work items belonging to this group.

Signals

void allFinished ()
 This will be emitted additionally to any function or block submitted via notify().

Public Member Functions

 QDispatchGroup ()
 Creates a new QDispatchGroup.
 QDispatchGroup (dispatch_group_t)
 QDispatchGroup (const QDispatchGroup &)
 QDispatchGroup (const xdispatch::group &)
 ~QDispatchGroup ()
void async (QRunnable *r, const xdispatch::queue &=xdispatch::global_queue())
 Dispatches a Runnable on the given Queue.
void async (xdispatch::operation *, const xdispatch::queue &=xdispatch::global_queue())
 Dispatches an operation on the given Queue.
void async (dispatch_block_t b, const xdispatch::queue &=xdispatch::global_queue())
 Same as dispatch(operation* r, ...) Will wrap the given block in an operation and put it on the queue.
bool wait (const QTime &t)
 Waits until the given time has passed or all dispatched runnables in the group were executed.
void notify (QRunnable *r, const xdispatch::queue &=xdispatch::global_queue())
 This function schedules a notification runnable to be submitted to the specified queue once all runnables associated with the dispatch group have completed.
void notify (xdispatch::operation *, const xdispatch::queue &=xdispatch::global_queue())
void notify (dispatch_block_t, const xdispatch::queue &=xdispatch::global_queue())

Friends

Q_DECL_EXPORT QDebug operator<< (QDebug, const QDispatchGroup &)

Detailed Description

A DispatchGroup is a group of QRunnables dispatched on queues.

This class provides a way to track all these QRunnables and notify you if all of them finished executing.

See also Apple's Documentation of Dispatch Groups


Constructor & Destructor Documentation

QDispatchGroup::QDispatchGroup ( )

Creates a new QDispatchGroup.

QDispatchGroup::QDispatchGroup ( dispatch_group_t  )
QDispatchGroup::QDispatchGroup ( const QDispatchGroup )
QDispatchGroup::QDispatchGroup ( const xdispatch::group )
QDispatchGroup::~QDispatchGroup ( )

Member Function Documentation

void QDispatchGroup::allFinished ( ) [signal]

This will be emitted additionally to any function or block submitted via notify().

Every time the all work dispatched to the group (i.e. the group is empty) this signal will be emitted.

void QDispatchGroup::async ( QRunnable *  r,
const xdispatch::queue = xdispatch::global_queue() 
)

Dispatches a Runnable on the given Queue.

Parameters:
rThe QRunnable to be dispatched
qThe Queue to use. If no Queue is given, the system default queue will be used
void QDispatchGroup::async ( xdispatch::operation r,
const xdispatch::queue q = xdispatch::global_queue() 
)

Dispatches an operation on the given Queue.

Parameters:
rThe operation to be dispatched
qThe Queue to use. If no Queue is given, the system default queue will be used

Reimplemented from xdispatch::group.

void QDispatchGroup::async ( dispatch_block_t  b,
const xdispatch::queue q = xdispatch::global_queue() 
)

Same as dispatch(operation* r, ...) Will wrap the given block in an operation and put it on the queue.

Reimplemented from xdispatch::group.

void QDispatchGroup::notify ( dispatch_block_t  ,
const xdispatch::queue = xdispatch::global_queue() 
)
void QDispatchGroup::notify ( QRunnable *  r,
const xdispatch::queue = xdispatch::global_queue() 
)

This function schedules a notification runnable to be submitted to the specified queue once all runnables associated with the dispatch group have completed.

If no runnables are associated with the dispatch group (i.e. the group is empty) then the notification runnable will be submitted immediately.

The runnable 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.

See also:
dispatch() for more information.
void QDispatchGroup::notify ( xdispatch::operation ,
const xdispatch::queue = xdispatch::global_queue() 
)
void QDispatchGroup::resume ( ) [virtual, slot]

Resumes the invocation of work items belonging to this group.

Calls to suspend() must be balanced with calls to resume().

Reimplemented from xdispatch::group.

void QDispatchGroup::suspend ( ) [virtual, slot]

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().

Reimplemented from xdispatch::group.

bool QDispatchGroup::wait ( const QTime &  t)

Waits until the given time has passed or all dispatched runnables in the group were executed.

Parameters:
timeoutgive a timeout here or a QTime of zero to wait until all runnables are done
Returns:
false if the timeout occured or true if all runnables were executed

Friends And Related Function Documentation

Q_DECL_EXPORT QDebug operator<< ( QDebug  ,
const QDispatchGroup  
) [friend]

The documentation for this class was generated from the following file:

Generated on Wed Feb 22 2012 19:57:00 for libXDispatch by Doxygen 1.7.4
Content © 2011-2012 MLBA (about | privacy) – Design © 2010-2012 Emzeat. All Rights reserved.