Contents

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

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

Discussion

If the task is canceled before the time ends, this function throws CancellationError.

This function doesn’t block the underlying thread.