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

Function fiberJoinAll

repos/effect/packages/effect/src/internal/effect.ts:781–807  ·  view source on GitHub ↗
(self: A)

Source from the content-addressed store, hash-verified

779 self: Iterable<Fiber>
780): Effect.Effect<
781 Array<
782 Exit.Exit<
783 Fiber extends Fiber.Fiber<infer _A, infer _E> ? _A : never,
784 Fiber extends Fiber.Fiber<infer _A, infer _E> ? _E : never
785 >
786 >
787> =>
788 callback((resume) => {
789 const iter = self[Symbol.iterator]() as Iterator<FiberImpl>
790 const exits: Array<Exit.Exit<any, any>> = []
791 let cancel: (() => void) | undefined = undefined
792 function loop() {
793 let result = iter.next()
794 while (!result.done) {
795 if (result.value._exit) {
796 exits.push(result.value._exit)
797 result = iter.next()
798 continue
799 }
800 cancel = result.value.addObserver((exit) => {
801 exits.push(exit)
802 loop()
803 })
804 return
805 }
806 resume(succeed(exits))
807 }
808 loop()
809 return sync(() => cancel?.())
810 })

Callers

nothing calls this directly

Calls 7

pushMethod · 0.80
addObserverMethod · 0.80
callbackFunction · 0.70
succeedFunction · 0.70
forEachMethod · 0.65
resumeFunction · 0.50
cancelFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…