import type { InterruptStatus } from "../Fiber/core.js"; import type { FiberID } from "../Fiber/id.js"; import type { Effect } from "./effect.js"; /** * Performs this effect uninterruptibly. This will prevent the effect from * being terminated externally, but the effect may fail for internal reasons * (e.g. an uncaught error) or terminate due to defect. * * Uninterruptible effects may recover from all failure causes (including * interruption of an inner effect that has been made interruptible). */ export declare const uninterruptible: (effect: Effect) => Effect; /** * Used to restore the inherited interruptibility */ export interface InterruptStatusRestore { readonly restore: (effect: Effect, __trace?: string) => Effect; readonly force: (effect: Effect, __trace?: string) => Effect; } export declare class InterruptStatusRestoreImpl implements InterruptStatusRestore { readonly flag: InterruptStatus; constructor(flag: InterruptStatus); restore(effect: Effect, __trace?: string): Effect; force(effect: Effect, __trace?: string): Effect; } /** * Makes the effect uninterruptible, but passes it a restore function that * can be used to restore the inherited interruptibility from whatever region * the effect is composed into. */ export declare function uninterruptibleMask(f: (restore: InterruptStatusRestore) => Effect, __trace?: string): Effect; /** * Calls the specified function, and runs the effect it returns, if this * effect is interrupted. */ export declare function onInterrupt_(self: Effect, cleanup: (interruptors: readonly FiberID[]) => Effect, __trace?: string): Effect; /** * Calls the specified function, and runs the effect it returns, if this * effect is interrupted (allows for expanding error). */ export declare function onInterruptExtended_(self: Effect, cleanup: (interruptors: readonly FiberID[]) => Effect, __trace?: string): Effect; /** * Calls the specified function, and runs the effect it returns, if this * effect is interrupted. * * @ets_data_first onInterrupt_ */ export declare function onInterrupt(cleanup: (interruptors: readonly FiberID[]) => Effect, __trace?: string): (self: Effect) => Effect; /** * Returns an effect whose interruption will be disconnected from the * fiber's own interruption, being performed in the background without * slowing down the fiber's interruption. * * This method is useful to create "fast interrupting" effects. For * example, if you call this on a bracketed effect, then even if the * effect is "stuck" in acquire or release, its interruption will return * immediately, while the acquire / release are performed in the * background. * * See timeout and race for other applications. */ export declare function disconnect(effect: Effect, __trace?: string): Effect; /** * Makes the effect interruptible, but passes it a restore function that * can be used to restore the inherited interruptibility from whatever region * the effect is composed into. */ export declare function interruptibleMask(f: (restore: InterruptStatusRestore) => Effect, __trace?: string): Effect; /** * Returns an effect that is interrupted as if by the specified fiber. */ export declare function interruptAs(fiberId: FiberID, __trace?: string): import("./effect.js").IO; /** * Returns an effect that is interrupted by the current fiber */ export declare const interrupt: Effect; /** * Returns a new effect that performs the same operations as this effect, but * interruptibly, even if composed inside of an uninterruptible region. * * Note that effects are interruptible by default, so this function only has * meaning if used within an uninterruptible region. * * WARNING: This operator "punches holes" into effects, allowing them to be * interrupted in unexpected places. Do not use this operator unless you know * exactly what you are doing. Instead, you should use `uninterruptibleMask`. */ export declare function interruptible(effect: Effect, __trace?: string): Effect; //# sourceMappingURL=interruption.d.ts.map