/** * detach/drivers/setImmediate.ts — Defer detached work to a Node.js * `setImmediate` boundary. * * Pattern: Same producer-consumer batch flush as `microtaskBatch`, * but the deferral is `setImmediate` instead of * `queueMicrotask`. Yields control back to the event loop * BEFORE running — allows pending I/O callbacks to drain * first, which microtasks would block. * Role: Node-specific driver for "fire-and-forget after the * current I/O tick." Use when the parent stage handles * latency-sensitive work and you don't want detached work * to compete for the synchronous slice. * * When to pick this over microtaskBatch: * - You're shipping logs / metrics in a hot HTTP path and don't * want them blocking the response from being flushed * - The detached work itself is CPU-heavy enough that running it on * the same microtask cycle would delay other microtasks * - You explicitly want "next event-loop tick" semantics — useful * when interacting with third-party libraries that expect at * least one I/O tick between schedule and execution * * Capability: * - `nodeSafe: true` — relies on Node's `setImmediate`, NOT * available in browsers / Deno / Cloudflare Workers (use * `setTimeoutDriver` for cross-runtime alternative) */ import { type ChildRunner } from '../runChild.js'; import type { DetachDriver } from '../types.js'; export declare function createSetImmediateDriver(runChild?: ChildRunner): DetachDriver; export declare const setImmediateDriver: DetachDriver;