Function

dispatch_block_cancel

Cancels the specified dispatch block asynchronously.

Declaration

void dispatch_block_cancel(dispatch_block_t block);

Parameters

block

The dispatch block to cancel.

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.

Discussion

Cancellation causes any future execution of the dispatch block to return immediately, but does not affect any execution of the block object that is already in progress.

Release of any resources associated with the block object is delayed until execution of the block object is next attempted (or any execution already in progress completes).

See Also

Canceling a Work Item

dispatch_block_testcancel

Tests whether the given dispatch block has been canceled.

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