<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Event",
  "identifier" : "/documentation/Event/EventLoop/sleep(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Event"
    ],
    "preciseIdentifier" : "s:5Event0A4LoopC5sleep3forys8DurationV_tYaF"
  },
  "title" : "sleep(for:)"
}
-->

# sleep(for:)

Suspends the current task for `duration`, driven by this event loop.

```
func sleep(for duration: Duration) async
```

## Parameters

`duration`

How long to suspend. Negative or zero durations return
on the next loop iteration.

## Discussion

Unlike `Task.sleep(for:)`, which goes through the global Swift concurrency
clock, this routes the wait through libevent’s timer wheel — useful when you
want sleeps to share scheduling with the same multiplexer that’s driving your
I/O. Internally registers a one-shot timer via [`schedule(after:_:)`](/documentation/Event/EventLoop/schedule(after:_:)) and
drives the loop until it fires.