Supervisor

cats.effect.std.Supervisor$
See theSupervisor companion trait
object Supervisor

Attributes

Companion
trait
Source
Supervisor.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Supervisor.type

Members list

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.

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

Attributes

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
def apply[F[_] : Concurrent]: Resource[F, Supervisor[F]]

Attributes

Source
Supervisor.scala