---
title: "addBarrierBlock(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/operationqueue/addbarrierblock(_:)"
---

# addBarrierBlock(_:)

Invokes a block when the queue finishes all enqueued operations, and prevents subsequent operations from starting until the block has completed.

## Declaration

```swift
func addBarrierBlock(_ barrier: @escaping @Sendable () -> Void)
```

## Parameters

- `barrier`: The block to invoke after all currently enqueued operations have finished. Operations you add after the barrier block don’t start until the block has completed.

## Discussion

Discussion This method is similar to dispatch_barrier_async.

## See Also

### Managing Operations in the Queue

- [addOperation(_:)](foundation/operationqueue/addoperation(_:)-64o8a.md)
- [addOperations(_:waitUntilFinished:)](foundation/operationqueue/addoperations(_:waituntilfinished:).md)
- [addOperation(_:)](foundation/operationqueue/addoperation(_:)-5s294.md)
- [cancelAllOperations()](foundation/operationqueue/cancelalloperations().md)
- [waitUntilAllOperationsAreFinished()](foundation/operationqueue/waituntilalloperationsarefinished().md)
- [operations](foundation/operationqueue/operations.md)
- [operationCount](foundation/operationqueue/operationcount.md)
