MCPcopy Create free account
hub / github.com/Effect-TS/effect / completeRace

Function completeRace

packages/effect/src/internal/fiberRuntime.ts:3691–3701  ·  view source on GitHub ↗
(
  winner: Fiber.RuntimeFiber<any, any>,
  loser: Fiber.RuntimeFiber<any, any>,
  cont: (winner: Fiber.RuntimeFiber<any, any>, loser: Fiber.RuntimeFiber<any, any>) => Effect.Effect<any, any, any>,
  ab: MRef.MutableRef<boolean>,
  cb: (_: Effect.Effect<A2 | A3, E2 | E3, R | R1 | R2 | R3>) => void
)

Source from the content-addressed store, hash-verified

3689 }))
3690
3691const completeRace = <A2, A3, E2, E3, R, R1, R2, R3>(
3692 winner: Fiber.RuntimeFiber<any, any>,
3693 loser: Fiber.RuntimeFiber<any, any>,
3694 cont: (winner: Fiber.RuntimeFiber<any, any>, loser: Fiber.RuntimeFiber<any, any>) => Effect.Effect<any, any, any>,
3695 ab: MRef.MutableRef<boolean>,
3696 cb: (_: Effect.Effect<A2 | A3, E2 | E3, R | R1 | R2 | R3>) => void
3697): void => {
3698 if (MRef.compareAndSet(true, false)(ab)) {
3699 cb(cont(winner, loser))
3700 }
3701}
3702
3703/** @internal */
3704export const ensuring: {

Callers 1

fiberRuntime.tsFile · 0.85

Calls 1

contFunction · 0.85

Tested by

no test coverage detected