SlotPool

tcmts.cli.budget.SlotPool · #obbye3ho · type

Slots taken from a slotPool: release gives them back.

import type { SlotWait } from "#codebase/tcmts/cli/budget";

export interface SlotPool {
  /** how many slots there are */
  size: number;
  /**
   * Wait for `count` slots (at most the pool's size), all at once, after whoever was waiting first: `onWait` is told
   * what it waits on each time it looks and has to wait on (a few times a second; {@link slotWaits} says it). Returns
   * what gives them back.
   */
  take(what: string, onWait?: (w: SlotWait) => void, count?: number): Promise<() => void>;
}

uses

used by