XDispatch 0.6.1
Public Member Functions
xdispatch::group Class Reference

A group is a group of operations dispatched on queues. More...

#include <xdispatch/group.h>

Inheritance diagram for xdispatch::group:

List of all members.

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
groupoperator= (const group &)
bool operator== (const object &)
bool operator== (const dispatch_object_t &)
bool operator!= (const object &)
bool operator!= (const dispatch_object_t &)

Detailed Description

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

Definition at line 43 of file group.h.


Constructor & Destructor Documentation

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

Member Function Documentation

void xdispatch::group::async ( operation r,
const queue q = 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
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.

dispatch_object_t xdispatch::group::native ( ) const [virtual]
Returns:
The dispatch_group_t object associated with this C++ object. Use this, if you need to use the plain C Interface of libdispatch.

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.

See also:
dispatch() for more information.

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.

See also:
dispatch() for more information.

Reimplemented in QDispatchGroup.

bool xdispatch::object::operator!= ( const object ) [inherited]
bool xdispatch::object::operator!= ( const dispatch_object_t ) [inherited]
group& xdispatch::group::operator= ( const group )
bool xdispatch::object::operator== ( const dispatch_object_t ) [inherited]
bool xdispatch::object::operator== ( const object ) [inherited]
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 ( dispatch_time_t  = DISPATCH_TIME_FOREVER)

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

Parameters:
tgive a time here or a DISPATCH_TIME_FOREVER to wait until all operations are done
Returns:
false if the timeout occured or true if all operations were executed
bool xdispatch::group::wait ( struct tm *  t)

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

Parameters:
timeoutgive a timeout here
Returns:
false if the timeout occured or true if all operations were executed

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Thu Apr 12 2012 09:50:43 for XDispatch by Doxygen 1.7.4
© 2010-2012 MLBA (about | privacy) All Rights reserved.