Function

dispatch_barrier_async_f

Submits a barrier function for asynchronous execution and returns immediately.

Declaration

void dispatch_barrier_async_f(dispatch_queue_t queue, void *context, dispatch_function_t work);

Parameters

queue

The dispatch queue on which to execute the barrier function. The queue is retained by the system until the function has run to completion. This parameter cannot be NULL.

context

The application-defined context parameter to pass to the function.

work

The application-defined barrier function to be executed. The first parameter passed to this function is the value of the context parameter. This parameter cannot be NULL.

Discussion

Calls to this function always return immediately after the barrier function has been submitted and never wait for that function to be invoked. When the barrier function reaches the front of a private concurrent queue, it is not executed immediately. Instead, the queue waits until its currently executing blocks finish executing. At that point, the queue executes the barrier function by itself. Any blocks submitted after the barrier function are not executed until the barrier function completes.

The queue you specify should be a concurrent queue that you create yourself using the dispatch_queue_create function. If the queue you pass to this function is a serial queue or one of the global concurrent queues, this function behaves like the dispatch_async function.

See Also

Creating a Barrier Asynchronously

dispatch_barrier_async

Submits a barrier block for asynchronous execution and returns immediately.