---
title: "sleep(until:tolerance:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/suspendingclock/sleep(until:tolerance:)"
---

# sleep(until:tolerance:)

Suspend task execution until a given deadline within a tolerance. If no tolerance is specified then the system may adjust the deadline to coalesce CPU wake-ups to more efficiently process the wake-ups in a more power efficient manner.

## Declaration

```swift
func sleep(until deadline: SuspendingClock.Instant, tolerance: Duration? = nil) async throws
```

## Discussion

Discussion If the task is canceled before the time ends, this function throws CancellationError. This function doesn’t block the underlying thread.
