<!--
{
  "documentType" : "article",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch-barrier",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Dispatch Barrier"
}
-->

# Dispatch Barrier

A synchronization point for tasks executing in a concurrent dispatch queue.

## Discussion

Use a barrier to synchronize the execution of one or more tasks in your dispatch queue. When you add a barrier to a concurrent dispatch queue, the queue delays the execution of the barrier block (and any tasks submitted after the barrier) until all previously submitted tasks finish executing. After the previous tasks finish executing, the queue executes the barrier block by itself. Once the barrier block finishes, the queue resumes its normal execution behavior.

## Topics

### Creating a Barrier Asynchronously

[`dispatch_barrier_async`](/documentation/Dispatch/dispatch_barrier_async)

Submits a barrier block for asynchronous execution and returns immediately.

[`dispatch_barrier_async_f`](/documentation/Dispatch/dispatch_barrier_async_f)

Submits a barrier function for asynchronous execution and returns immediately.

### Creating a Barrier Synchronously

[`dispatch_barrier_sync`](/documentation/Dispatch/dispatch_barrier_sync)

Submits a barrier block object for execution and waits until that block completes.

[`dispatch_barrier_sync_f`](/documentation/Dispatch/dispatch_barrier_sync_f)

Submits a barrier function for execution and waits until that function completes.

[`dispatch_barrier_async_and_wait`](/documentation/Dispatch/dispatch_barrier_async_and_wait)

Submits a work item for synchronous execution and marks the work as a barrier for subsequent concurrent tasks.

[`dispatch_barrier_async_and_wait_f`](/documentation/Dispatch/dispatch_barrier_async_and_wait_f)

Submits a function-based work item for synchronous execution and marks the work as a barrier for subsequent concurrent tasks.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)