Hyperlinkv0.8.0-beta.28

Effect

Effect.uninterruptibleMaskconsteffect/Effect.ts:7362
<A, E, R>(
  f: (
    restore: <AX, EX, RX>(
      effect: Effect<AX, EX, RX>
    ) => Effect<AX, EX, RX>
  ) => Effect<A, E, R>
): Effect<A, E, R>

Disables interruption and provides a restore function to restore the interruptible state within the effect.

Example (Restoring interruption in protected regions)

import { Console, Effect } from "effect"

const program = Effect.uninterruptibleMask((restore) =>
  Effect.gen(function*() {
    yield* Console.log("Uninterruptible phase...")
    yield* Effect.sleep("1 second")

    // Restore interruptibility for this part
    yield* restore(
      Effect.gen(function*() {
        yield* Console.log("Interruptible phase...")
        yield* Effect.sleep("2 seconds")
      })
    )

    yield* Console.log("Back to uninterruptible")
  })
)
interruption
Source effect/Effect.ts:73625 lines
export const uninterruptibleMask: <A, E, R>(
  f: (
    restore: <AX, EX, RX>(effect: Effect<AX, EX, RX>) => Effect<AX, EX, RX>
  ) => Effect<A, E, R>
) => Effect<A, E, R> = internal.uninterruptibleMask
Referenced by 8 symbols