group.h
IntroductionUse the links in the table of contents to the left to access the documentation. Functions
dispatch_group_asyncSubmits a block to a dispatch queue and associates the block with the given dispatch group. #if (defined( 1)) ( macos( 10.6), ios( 4.0)) void dispatch_group_async( dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block); #endif /* __BLOCKS__ */ ParametersDiscussionSubmits 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. dispatch_group_async_fSubmits a function to a dispatch queue and associates the block with the given dispatch group. ( macos( 10.6), ios( 4.0)) DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4 void dispatch_group_async_f( dispatch_group_t group, dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); Parameters
DiscussionSee dispatch_group_async() for details. dispatch_group_createCreates new group with which blocks may be associated. ( macos( 10.6), ios( 4.0)) DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED dispatch_group_t dispatch_group_create( void); Return ValueThe newly created group, or NULL on failure. DiscussionThis 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(). dispatch_group_enterManually indicate a block has entered the group ( macos( 10.6), ios( 4.0)) void dispatch_group_enter( dispatch_group_t group); ParametersDiscussionCalling 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(). dispatch_group_leaveManually indicate a block in the group has completed ( macos( 10.6), ios( 4.0)) void dispatch_group_leave( dispatch_group_t group); ParametersDiscussionCalling this function indicates block has completed and left the dispatch group by a means other than dispatch_group_async(). dispatch_group_notifySchedule a block to be submitted to a queue when all the blocks associated with a group have completed. #if (defined( 1)) ( macos( 10.6), ios( 4.0)) void dispatch_group_notify( dispatch_group_t group, dispatch_queue_t queue, dispatch_block_t block); #endif /* __BLOCKS__ */ ParametersDiscussionThis 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. dispatch_group_notify_fSchedule a function to be submitted to a queue when all the blocks associated with a group have completed. ( macos( 10.6), ios( 4.0)) DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4 void dispatch_group_notify_f( dispatch_group_t group, dispatch_queue_t queue, void *_Nullable context, dispatch_function_t work); Parameters
DiscussionSee dispatch_group_notify() for details. dispatch_group_waitWait synchronously until all the blocks associated with a group have completed or until the specified timeout has elapsed. ( macos( 10.6), ios( 4.0)) intptr_t dispatch_group_wait( dispatch_group_t group, dispatch_time_t timeout); ParametersReturn ValueReturns zero on success (all blocks associated with the group completed within the specified timeout) or non-zero on error (i.e. timed out). DiscussionThis 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. 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 multiple 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. Typedefs
dispatch_group_tA group of blocks submitted to queues for asynchronous invocation. typedef struct dispatch_group_s *dispatch_group_t; |