-
Notifications
You must be signed in to change notification settings - Fork 559
Closed
Labels
Description
Running the following code:
package io.github.timwspence.cats.stm
import cats.effect._
object Test extends IOApp.Simple {
override def run: IO[Unit] =
for {
d <- IO.deferred[Int]
f <- d.get.start
_ <- f.join
_ <- d.complete(1)
} yield ()
}
on JDK 17 and pressing Crtl-T
for a fiber dump yields the following:
cats.effect.IOFiber@707af0cd WAITING
cats.effect.IOFiber@539c7a54 WAITING
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
╰ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
cats.effect.IOFiber@539c7a54 ACTIVE
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
├ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
╰ main @ jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Thread[io-compute-5,5,run-main-group-1] (#5): 0 enqueued
Thread[io-compute-11,5,run-main-group-1] (#11): 0 enqueued
Thread[io-compute-2,5,run-main-group-1] (#2): 0 enqueued
Thread[io-compute-4,5,run-main-group-1] (#4): 0 enqueued
Thread[io-compute-9,5,run-main-group-1] (#9): 0 enqueued
Thread[io-compute-1,5,run-main-group-1] (#1): 0 enqueued
Thread[io-compute-6,5,run-main-group-1] (#6): 0 enqueued
Thread[io-compute-3,5,run-main-group-1] (#3): 0 enqueued
Thread[io-compute-7,5,run-main-group-1] (#7): 0 enqueued
Thread[io-compute-0,5,run-main-group-1] (#0): 0 enqueued
Thread[io-compute-8,5,run-main-group-1] (#8): 0 enqueued
Thread[io-compute-10,5,run-main-group-1] (#10): 0 enqueued
Global: enqueued 0, foreign 1, waiting 2
Note that fiber 539c7a54
is duplicated as both active and waiting. I've re-run it a bunch of times and the output appears to be deterministic