MCPcopy
hub / github.com/Effect-TS/effect / deferredAwait

Function deferredAwait

packages/effect/src/internal/core.ts:2860–2873  ·  view source on GitHub ↗
(self: Deferred.Deferred<A, E>)

Source from the content-addressed store, hash-verified

2858
2859/* @internal */
2860export const deferredAwait = <A, E>(self: Deferred.Deferred<A, E>): Effect.Effect<A, E> =>
2861 asyncInterrupt<A, E>((resume) => {
2862 const state = MutableRef.get(self.state)
2863 switch (state._tag) {
2864 case DeferredOpCodes.OP_STATE_DONE: {
2865 return resume(state.effect)
2866 }
2867 case DeferredOpCodes.OP_STATE_PENDING: {
2868 // we can push here as the internal state is mutable
2869 state.joiners.push(resume)
2870 return deferredInterruptJoiner(self, resume)
2871 }
2872 }
2873 }, self.blockingOn)
2874
2875/* @internal */
2876export const deferredComplete: {

Callers 1

commitFunction · 0.85

Calls 4

asyncInterruptFunction · 0.85
deferredInterruptJoinerFunction · 0.85
resumeFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected