Supervisor

object Supervisor
Companion:
class
Source:
Supervisor.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[F[_]](await: Boolean)(implicit F: Concurrent[F]): Resource[F, Supervisor[F]]

Creates a cats.effect.kernel.Resource scope within which fibers can be monitored. When this scope exits, all supervised fibers will be finalized.

Creates a cats.effect.kernel.Resource scope within which fibers can be monitored. When this scope exits, all supervised fibers will be finalized.

Value parameters:
await

the termination policy

  • true - wait for the completion of the active fibers
  • false - cancel the active fibers
Note:

if an effect that never completes, is supervised by a Supervisor with awaiting termination policy, the termination of the Supervisor is indefinitely suspended

 val io: IO[Unit] = // never completes
   Supervisor[IO](await = true).use { supervisor =>
     supervisor.supervise(IO.never).void
   }
Source:
Supervisor.scala