Hyperlinkv0.8.0-beta.28

FiberMap

FiberMap.joinconsteffect/FiberMap.ts:993
<K, A, E>(self: FiberMap<K, A, E>): Effect.Effect<void, E>

Waits for the FiberMap to fail or close.

Details

The returned Effect fails with the first managed fiber failure that is not ignored by the map's interruption rules. Normal successful completion removes fibers from the map; use awaitEmpty to wait until the map has no fibers.

Example (Joining failing fibers)

import { Effect, FiberMap } from "effect"

Effect.gen(function*() {
  const map = yield* FiberMap.make()
  yield* FiberMap.set(map, "a", Effect.runFork(Effect.fail("error")))

  // parent fiber will fail with "error"
  yield* FiberMap.join(map)
})
combinators
export const join = <K, A, E>(self: FiberMap<K, A, E>): Effect.Effect<void, E> =>
  Deferred.await(self.deferred as Deferred.Deferred<void, E>)