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

# performAndWait(_:)

Submits a closure to the context’s queue for synchronous execution.

## Declaration

```swift
@preconcurrency nonisolated func performAndWait<T>(_ block: @Sendable () throws -> T) rethrows -> T
```

## Parameters

- `block`: The closure to perform.

## 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(_:)-ypye.md)
- [NSManagedObjectContext.ScheduledTaskType](coredata/nsmanagedobjectcontext/scheduledtasktype.md)
