Import std.concurrent.cancellation
Sleep
function
Public Function Sleep(time: Duration, cancel: Cancellation) Throws CancelledError
Sleeps for time unless the cancellation is cancelled first, or is already, which throws a
CancelledError. A time of 0 or less doesn't sleep.
Examples
Local cancel = Cancellation()
cancel.Cancel()
// A cancelled Cancellation stops the Sleep before it starts.
Expect(ExpectThrows<CancelledError>(Sleep(10.Seconds, cancel)) != Null)Report an issue with this page or with FutureBlitz on GitHub.