From e4e7bb86cd3051325a0eafd7d6a1449cfdc663e5 Mon Sep 17 00:00:00 2001 From: Vasil Vasilev Date: Fri, 12 Feb 2021 21:15:11 +0100 Subject: [PATCH] Null out reference to last stolen fiber --- .../src/main/scala/cats/effect/unsafe/WorkStealingQueue.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/core/jvm/src/main/scala/cats/effect/unsafe/WorkStealingQueue.scala b/core/jvm/src/main/scala/cats/effect/unsafe/WorkStealingQueue.scala index 3edb561c1e..c5bfb2671f 100644 --- a/core/jvm/src/main/scala/cats/effect/unsafe/WorkStealingQueue.scala +++ b/core/jvm/src/main/scala/cats/effect/unsafe/WorkStealingQueue.scala @@ -305,6 +305,7 @@ private final class WorkStealingQueue { // fiber has already been written by `internalStealInto` but the // tail has still not been published. val ret = dst.buffer(retIdx) + dst.buffer(retIdx) = null if (n == 0) { // No need for arithmetic and volatile updates. We are immediately