---
title: "wait(timeout:)"
framework: dispatch
role: symbol
role_heading: Instance Method
path: "dispatch/dispatchworkitem/wait(timeout:)"
---

# wait(timeout:)

Causes the caller to wait synchronously until the dispatch work item finishes executing, or until the specified time elapses.

## Declaration

```swift
func wait(timeout: DispatchTime) -> DispatchTimeoutResult
```

## Parameters

- `timeout`: The time at which to stop waiting for the dispatch item to finish. Specifying doc://com.apple.dispatch/documentation/Dispatch/DispatchTime/distantFuture is equivalent to calling the doc://com.apple.dispatch/documentation/Dispatch/DispatchWorkItem/wait() method.

## Return Value

Return Value DispatchTimeoutResult.success if the method returned because the work item finished executing, or DispatchTimeoutResult.timedOut if the timeout value was reached.

## Discussion

Discussion This method returns immediately if the current work item has already finished executing.

## See Also

### Waiting for the Completion of a Work Item

- [wait()](dispatch/dispatchworkitem/wait().md)
- [wait(wallTimeout:)](dispatch/dispatchworkitem/wait(walltimeout:).md)
- [DispatchTime](dispatch/dispatchtime.md)
- [DispatchWallTime](dispatch/dispatchwalltime.md)
