XDispatch 0.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
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 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
groupoperator= (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 &)

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 48 of file group.h.


Constructor & Destructor Documentation

Creates a new group.

Creates a new group out of the existing dispatch_group_t.


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() 
) [inline]

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

Definition at line 73 of file group.h.

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

Implements xdispatch::object.

Returns:
The dispatch_group_t object associated with this C++ object. Use this, if you need to use the plain C Interface of libdispatch.
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:
libdispatch for more information.

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.

See also:
libdispatch for more information.

Reimplemented in QDispatchGroup.

Definition at line 127 of file group.h.

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

Remarks:
Calls to suspend() should be balanced with calls to resume() to continue an object

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.

Remarks:
This has no effect on the global queues and the main queue.

Reimplemented in xdispatch::source.

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 *  timeout)

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 Sun Oct 28 2012 22:12:47 for XDispatch by Doxygen 1.7.6.1
© 2010-2012 MLBA (about | privacy) All Rights reserved.