Setu-TS
    Preparing search index...

    Interface IWorkerHost

    Thread-spawning primitive provided by runtimes that support worker threads. Absent on runtimes without them (e.g. Cloudflare Workers) — consumers MUST degrade gracefully when it is not provided (see the WorkerPoolPlugin, which fails run() with a typed error when no host exists).

    0.1.0

    interface IWorkerHost {
        availableParallelism(): number;
        reportsExit?(): boolean;
        spawn(specifier: string): IWorkerHandle;
    }
    Index
    • Number of threads the host can usefully run in parallel.

      Returns number

      The available parallelism (at least 1)

    • Reports whether handles from spawn will implement IWorkerHandle.onExit.

      Answerable BEFORE a worker exists, which is the reason it sits here rather than being inferred from a handle: a consumer that must warn about — or configure around — undetectable worker death has to know at registration time, and the first spawn may be far later or never happen at all.

      Optional so an existing custom host stays valid; a host that omits it is treated exactly as one reporting false.

      Returns boolean

      true when an exit signal is available on this runtime

      0.3.0