MCPcopy Create free account
hub / github.com/effect-app/libs / fiberAwaitAll

Function fiberAwaitAll

repos/effect/packages/effect/src/internal/effect.ts:736–768  ·  view source on GitHub ↗
(
  self: Iterable<Fiber>
)

Source from the content-addressed store, hash-verified

734}
735
736const deferredInterruptCont: any = {
737 [contA](_value: unknown, fiber: FiberImpl) {
738 return failCause(fiber._interruptedCause!)
739 },
740 [contE](_cause: unknown, fiber: FiberImpl) {
741 return failCause(fiber._interruptedCause!)
742 }
743}
744
745const fiberMiddleware = {
746 interruptChildren: undefined as
747 | ((fiber: FiberImpl) => Effect.Effect<void> | undefined)
748 | undefined
749}
750
751const fiberStackAnnotations = (fiber: Fiber.Fiber<any, any>) => {
752 if (!fiber.currentStackFrame) return undefined
753 const annotations = new Map<string, unknown>()
754 annotations.set(InterruptorStackTrace.key, fiber.currentStackFrame)
755 return Context.makeUnsafe(annotations)
756}
757
758const fiberInterruptChildren = (fiber: FiberImpl) => {
759 if (fiber._children === undefined || fiber._children.size === 0) {
760 return undefined
761 }
762 return fiberInterruptAll(fiber._children)
763}
764
765/** @internal */
766export const fiberAwait = <A, E>(
767 self: Fiber.Fiber<A, E>
768): Effect.Effect<Exit.Exit<A, E>> => {
769 const impl = self as FiberImpl<A, E>
770 if (impl._exit) return succeed(impl._exit)
771 return callback((resume) => {

Callers 2

fiberInterruptAllFunction · 0.85
effect.tsFile · 0.85

Calls 4

callbackFunction · 0.70
loopFunction · 0.70
syncFunction · 0.50
cancelFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…