wait(timeout:)
Causes the caller to wait synchronously until the dispatch work item finishes executing, or until the specified time elapses.
Declaration
func wait(timeout: DispatchTime) -> DispatchTimeoutResultParameters
- timeout:
The time at which to stop waiting for the dispatch item to finish. Specifying Distantfuture is equivalent to calling the Wait() method.
Return Value
DispatchTimeoutResult.success if the method returned because the work item finished executing, or DispatchTimeoutResult.timedOut if the timeout value was reached.
Discussion
This method returns immediately if the current work item has already finished executing.