File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
core/jvm/src/main/scala/cats/effect/unsafe Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import cats.effect.tracing.TracingConstants
3636import scala .collection .mutable
3737import scala .concurrent .ExecutionContextExecutor
3838import scala .concurrent .duration .{Duration , FiniteDuration }
39+ import scala .util .control .NonFatal
3940
4041import java .time .Instant
4142import java .time .temporal .ChronoField
@@ -662,7 +663,14 @@ private[effect] final class WorkStealingThreadPool[P](
662663
663664 override def sleep (delay : FiniteDuration , task : Runnable ): Runnable = {
664665 val cb = new AtomicBoolean with (Right [Nothing , Unit ] => Unit ) { // run at most once
665- def apply (ru : Right [Nothing , Unit ]) = if (compareAndSet(false , true )) task.run()
666+ def apply (ru : Right [Nothing , Unit ]) = if (compareAndSet(false , true )) {
667+ try {
668+ task.run()
669+ } catch {
670+ case ex if NonFatal (ex) =>
671+ reportFailure(ex)
672+ }
673+ }
666674 }
667675
668676 val cancel = sleepInternal(delay, cb)
You can’t perform that action at this time.
0 commit comments