Runs fn in a cancellationScope where it will be interrupted (as a Java thread) upon cancellation.
Runs fn in a cancellationScope where it will be interrupted (as a Java thread) upon cancellation.
Note that fn will need to handle both java.util.concurrent.CancellationException (when performing Gears operations such as .await) andjava.lang.InterruptedException, so the intended use case is usually to wrap interruptible Java operations, containing fn to a narrow scope.
Attributes
override def sleep(millis: Long)(using Async): Unit
Suspends the current Async context for at least millis milliseconds.
Suspends the current Async context for at least millis milliseconds.