libXDispatch 0.3.1
Functions
include/libdispatch/group.h File Reference

Go to the source code of this file.

Functions

 DISPATCH_DECL (dispatch_group)
__DISPATCH_BEGIN_DECLS
DISPATCH_EXPORT
dispatch_group_t 
dispatch_group_create (void)
DISPATCH_EXPORT void dispatch_group_async (dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block)
DISPATCH_EXPORT void dispatch_group_async_f (dispatch_group_t group, dispatch_queue_t queue, void *context, dispatch_function_t work)
DISPATCH_EXPORT long dispatch_group_wait (dispatch_group_t group, dispatch_time_t timeout)
DISPATCH_EXPORT void dispatch_group_notify (dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block)
DISPATCH_EXPORT void dispatch_group_notify_f (dispatch_group_t group, dispatch_queue_t queue, void *context, dispatch_function_t work)
DISPATCH_EXPORT void dispatch_group_enter (dispatch_group_t group)
DISPATCH_EXPORT void dispatch_group_leave (dispatch_group_t group)

Function Documentation

DISPATCH_DECL ( dispatch_group  )
DISPATCH_EXPORT void dispatch_group_async ( dispatch_group_t  group,
dispatch_queue_t  queue,
dispatch_block_t  block 
)

dispatch_group_async

Submits a block to a dispatch queue and associates the block with the given dispatch group.

Submits a block to a dispatch queue and associates the block with the given dispatch group. The dispatch group may be used to wait for the completion of the blocks it references.

Parameters:
groupA dispatch group to associate with the submitted block. The result of passing NULL in this parameter is undefined.
queueThe dispatch queue to which the block will be submitted for asynchronous invocation.
blockThe block to perform asynchronously.
DISPATCH_EXPORT void dispatch_group_async_f ( dispatch_group_t  group,
dispatch_queue_t  queue,
void *  context,
dispatch_function_t  work 
)

dispatch_group_async_f

Submits a function to a dispatch queue and associates the block with the given dispatch group.

See dispatch_group_async() for details.

Parameters:
groupA dispatch group to associate with the submitted function. The result of passing NULL in this parameter is undefined.
queueThe dispatch queue to which the function will be submitted for asynchronous invocation.
contextThe application-defined context parameter to pass to the function.
workThe application-defined function to invoke on the target queue. The first parameter passed to this function is the context provided to dispatch_group_async_f().
__DISPATCH_BEGIN_DECLS DISPATCH_EXPORT dispatch_group_t dispatch_group_create ( void  )

dispatch_group_create

Creates new group with which blocks may be associated.

This function creates a new group with which blocks may be associated. The dispatch group may be used to wait for the completion of the blocks it references. The group object memory is freed with dispatch_release().

Returns:
The newly created group, or NULL on failure.
DISPATCH_EXPORT void dispatch_group_enter ( dispatch_group_t  group)

dispatch_group_enter

Manually indicate a block has entered the group

Calling this function indicates another block has joined the group through a means other than dispatch_group_async(). Calls to this function must be balanced with dispatch_group_leave().

Parameters:
groupThe dispatch group to update. The result of passing NULL in this parameter is undefined.
DISPATCH_EXPORT void dispatch_group_leave ( dispatch_group_t  group)

dispatch_group_leave

Manually indicate a block in the group has completed

Calling this function indicates block has completed and left the dispatch groupJ by a means other than dispatch_group_async().

Parameters:
groupThe dispatch group to update. The result of passing NULL in this parameter is undefined.
DISPATCH_EXPORT void dispatch_group_notify ( dispatch_group_t  group,
dispatch_queue_t  queue,
dispatch_block_t  block 
)

dispatch_group_notify

Schedule a block to be submitted to a queue when a group of previously submitted blocks have completed.

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 released with dispatch_release() or reused for additional operations. See dispatch_group_async() for more information.

Parameters:
groupThe dispatch group to observe. The result of passing NULL in this parameter is undefined.
queueThe queue to which the supplied block will be submitted when the group completes.
blockThe block to submit when the group completes.
DISPATCH_EXPORT void dispatch_group_notify_f ( dispatch_group_t  group,
dispatch_queue_t  queue,
void *  context,
dispatch_function_t  work 
)

dispatch_group_notify_f

Schedule a function to be submitted to a queue when a group of previously submitted functions have completed.

See dispatch_group_notify() for details.

Parameters:
groupThe dispatch group to observe. The result of passing NULL in this parameter is undefined.
contextThe application-defined context parameter to pass to the function.
workThe application-defined function to invoke on the target queue. The first parameter passed to this function is the context provided to dispatch_group_notify_f().
DISPATCH_EXPORT long dispatch_group_wait ( dispatch_group_t  group,
dispatch_time_t  timeout 
)

dispatch_group_wait

Wait synchronously for the previously submitted blocks to complete; returns if the blocks have not completed within the specified timeout.

This function waits for the completion of the blocks associated with the given dispatch group, and returns after all blocks have completed or when the specified timeout has elapsed. When a timeout occurs, the group is restored to its original state.

This function will return immediately if there are no blocks associated with the dispatch group (i.e. the group is empty).

The result of calling this function from mulitple threads simultaneously with the same dispatch group is undefined.

After the successful return of this function, the dispatch group is empty. It may either be released with dispatch_release() or re-used for additional blocks. See dispatch_group_async() for more information.

Parameters:
groupThe dispatch group to wait on. The result of passing NULL in this parameter is undefined.
timeoutWhen to timeout (see dispatch_time). As a convenience, there are the DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
Returns:
Returns zero on success (all blocks associated with the group completed within the specified timeout) or non-zero on error (i.e. timed out).

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