---
title: "performAndWait(_:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmanagedobjectcontext/performandwait(_:)-ypye"
---

# performAndWait(_:)

Synchronously performs the specified closure on the context’s queue.

## Declaration

```swift
func performAndWait(_ block: @Sendable () -> Void)
```

## Parameters

- `block`: The closure to perform.

## Mentioned in

Using Core Data in the background

## Discussion

Discussion This method supports reentrancy — meaning it’s safe to call the method again, from within the closure, before the previous invocation completes.

## See Also

### Performing block operations

- [perform(_:)](coredata/nsmanagedobjectcontext/perform(_:).md)
- [perform(schedule:_:)](coredata/nsmanagedobjectcontext/perform(schedule:_:).md)
- [performAndWait(_:)](coredata/nsmanagedobjectcontext/performandwait(_:)-6aaf1.md)
- [NSManagedObjectContext.ScheduledTaskType](coredata/nsmanagedobjectcontext/scheduledtasktype.md)
