Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve Supervision Relationships In Race #7676

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion core-tests/shared/src/test/scala/zio/ZIOSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3507,7 +3507,19 @@ object ZIOSpec extends ZIOBaseSpec {
_ <- fiber.interrupt
_ <- promise2.await
} yield assertCompletes
}
},
test("interruption is propagated to grandchild in race in uninterruptible region") {
ZIO.uninterruptible {
for {
promise <- Promise.make[Nothing, Unit]
ref <- Ref.make(false)
left = promise.await
right = ZIO.never.raceAwait((promise.succeed(()) *> ZIO.never.interruptible).ensuring(ref.set(true)))
_ <- left.raceAwait(right).forkDaemon
_ <- ref.get.repeatUntilEquals(true)
} yield assertCompletes
}
} @@ nonFlaky
) @@ zioTag(interruption),
suite("RTS environment")(
test("provide is modular") {
Expand Down
3 changes: 0 additions & 3 deletions core/shared/src/main/scala/zio/ZIO.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,6 @@ sealed trait ZIO[-R, +E, +A]
val startLeftFiber = leftFiber.startSuspended()(Unsafe.unsafe)
val startRightFiber = rightFiber.startSuspended()(Unsafe.unsafe)

leftFiber.setFiberRef(FiberRef.forkScopeOverride, Some(parentFiber.scope))(Unsafe.unsafe)
rightFiber.setFiberRef(FiberRef.forkScopeOverride, Some(parentFiber.scope))(Unsafe.unsafe)

ZIO
.async[R1, E2, C](
{ cb =>
Expand Down