Function

dispatch_block_notify

Schedules a notification block to be submitted to a queue when the execution of a specified dispatch block has completed.

Declaration

void dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue, dispatch_block_t notification_block);

Parameters

block

The dispatch block to observe.

The result of passing NULL or a block object not returned by the dispatch_block_create or dispatch_block_create_with_qos_class function is undefined.

queue

The queue to which the supplied notification block is submitted when the observed block completes.

notification_block

The notification block to submit when the observed block object completes.

Discussion

This function submits the notification block immediately if execution of the observed block object has already completed.

It is not possible to be notified of multiple executions of the same block object with this interface. Instead, use the dispatch_group_notify function for that purpose.

A single dispatch block may either be observed one or more times and executed once, or it may be executed any number of times. The behavior of any other combination is undefined. Submission to a dispatch queue counts as an execution, even if cancellation using the dispatch_block_cancel function means the block's code never runs.

If multiple notification blocks are scheduled for a single block object, there is no defined order in which the notification blocks are submitted to their associated queues.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software