import type * as HKT from "@principia/prelude/HKT"; import type { Option } from "../../Option"; import type { Exit } from "../Exit/model"; import type { FiberRef } from "../FiberRef/model"; import type { Scope } from "../Scope"; import type { IO } from "../Task/model"; import type { FiberId } from "./FiberId"; import type { FiberStatus } from "./status"; export declare const URI = "Fiber"; export declare type URI = typeof URI; export declare type V = HKT.V<"E", "+">; /** * InterruptStatus tracks interruptability of the current stack region */ export declare class InterruptStatus { readonly isInterruptible: boolean; constructor(isInterruptible: boolean); get isUninteruptible(): boolean; get toBoolean(): boolean; } /** * A record containing information about a `Fiber`. */ export declare class FiberDescriptor { readonly id: FiberId; readonly status: FiberStatus; readonly interruptors: ReadonlySet; readonly interruptStatus: InterruptStatus; readonly scope: Scope>; constructor( id: FiberId, status: FiberStatus, interruptors: ReadonlySet, interruptStatus: InterruptStatus, scope: Scope> ); } /** * A fiber is a lightweight thread of execution that never consumes more than a * whole thread (but may consume much less, depending on contention and * asynchronicity). Fibers are spawned by forking ZIO effects, which run * concurrently with the parent effect. * * Fibers can be joined, yielding their result to other fibers, or interrupted, * which terminates the fiber, safely releasing all resources. */ export declare type Fiber = RuntimeFiber | SyntheticFiber; export interface CommonFiber { /** * Awaits the fiber, which suspends the awaiting fiber until the result of the * fiber has been determined. */ readonly await: IO>; /** * Gets the value of the fiber ref for this fiber, or the initial value of * the fiber ref, if the fiber is not storing the ref. */ readonly getRef: (fiberRef: FiberRef) => IO; /** * Inherits values from all {@link FiberRef} instances into current fiber. * This will resume immediately. */ readonly inheritRefs: IO; /** * Interrupts the fiber as if interrupted from the specified fiber. If the * fiber has already exited, the returned effect will resume immediately. * Otherwise, the effect will resume when the fiber exits. */ readonly interruptAs: (fiberId: FiberId) => IO>; /** * Tentatively observes the fiber, but returns immediately if it is not already done. */ readonly poll: IO>>; } export interface RuntimeFiber extends CommonFiber { _tag: "RuntimeFiber"; /** * The identity of the fiber. */ readonly id: FiberId; readonly scope: Scope>; /** * The status of the fiber. */ readonly status: IO; } export interface SyntheticFiber extends CommonFiber { _tag: "SyntheticFiber"; } /** * ```haskell * makeSynthetic :: Synthetic e a -> Fiber e a * ``` * * A type helper for building a Synthetic Fiber */ export declare const makeSynthetic: (_: SyntheticFiber) => Fiber; //# sourceMappingURL=model.d.ts.map