| 734 | } |
| 735 | |
| 736 | const 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 | |
| 745 | const fiberMiddleware = { |
| 746 | interruptChildren: undefined as |
| 747 | | ((fiber: FiberImpl) => Effect.Effect<void> | undefined) |
| 748 | | undefined |
| 749 | } |
| 750 | |
| 751 | const 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 | |
| 758 | const 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 */ |
| 766 | export 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) => { |