diff --git a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala index 301f35e19..26f6a5bbc 100644 --- a/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala +++ b/kyo-zio/shared/src/main/scala/kyo/ZIOs.scala @@ -4,6 +4,7 @@ import kyo.kernel.* import scala.concurrent.ExecutionContext import scala.util.control.NonFatal import zio.Exit +import zio.FiberId import zio.Runtime import zio.Unsafe import zio.ZIO @@ -19,17 +20,18 @@ object ZIOs: * @return * A Kyo effect that, when run, will execute the zio.ZIO */ - def get[E, A](v: => ZIO[Any, E, A])(using Frame, zio.Trace): A < (Abort[E] & Async) = + def get[E, A](v: => ZIO[Any, E, A])(using f: Frame, t: zio.Trace): A < (Abort[E] & Async) = IO.Unsafe { Unsafe.unsafely { - import zio.unsafeInterrupt given ce: CanEqual[E, E] = CanEqual.derived val p = Promise.Unsafe.init[E, A]() val f = Runtime.default.unsafe.fork(v) f.unsafe.addObserver { (exit: zio.Exit[E, A]) => p.completeDiscard(exit.toResult) } - p.onInterrupt(_ => discard(f.unsafeInterrupt())) + p.onInterrupt(_ => + discard(f.unsafe.interrupt(zio.Cause.interrupt(FiberId.None, zio.StackTrace(FiberId.None, zio.Chunk(t))))) + ) p.safe.get } } diff --git a/kyo-zio/shared/src/main/scala/zio/FiberInterop.scala b/kyo-zio/shared/src/main/scala/zio/FiberInterop.scala deleted file mode 100644 index 71731d929..000000000 --- a/kyo-zio/shared/src/main/scala/zio/FiberInterop.scala +++ /dev/null @@ -1,5 +0,0 @@ -package zio - -extension [E, A](fiber: Fiber.Runtime[E, A]) - def unsafeInterrupt()(using trace: Trace, u: Unsafe): Unit = - fiber.tellInterrupt(Cause.Interrupt(FiberId.None, StackTrace(FiberId.None, Chunk(trace))))