Skip to main content
Version: 2.x

Fiber.Status

Fiber.Status describes the current status of a Fiber.

Each fiber can be in one of the following status:

  • Done
  • Running
  • Suspended

In the following example, we are going to await on a never-ending fiber and determine the id of that fiber, which we are blocking on:

import zio._

for {
f1 <- ZIO.never.fork
f2 <- f1.await.fork
blockingOn <- f2.status
.collect(()) { case Fiber.Status.Suspended(_, _, blockingOn) =>
blockingOn
}
.eventually
} yield (assert(blockingOn == f1.id))

See Alsoโ€‹

ZIO Chat

๐Ÿ”ฅ Ignite your ZIO journey with ZIO Chat! ๐Ÿ”ฅ Ready to unravel the intricacies of ZIO? As your trusty sidekick, I'm here to light the way. No matter if you're wandering through functional forests or traversing effectful landscapes, I've got answers to keep you on track. Your ZIO adventure starts here โ€“ ask me anything and let's explore together!