Whether Stop() has been invoked. Once stopped, no further ProcessTasks
iterations are scheduled and AddTask is rejected.
Current number of tasks retained in the in-memory queue (pending + in-progress). Completed/failed tasks are removed once terminal, so this does not grow unbounded.
IShutdownable identity, surfaced in shutdown logs.
ProtectedProcessProtectedProcessProtectedProcessIShutdownable entry point. Aliased to Stop().
ProtectedStartStops the recursive ProcessTasks loop, cancels any pending timer, and
marks the queue as stopped so subsequent AddTask calls fail-fast. Idempotent.
Implements IShutdownable.Shutdown so ShutdownRegistry.ShutdownAll() can
drain queues during graceful shutdown.
Implemented by long-lived singletons (engines, services) that own background work — timers, intervals, subscriptions, sockets, child processes — so a coordinated shutdown can release them. Without this contract,
SIGTERM/SIGINThandlers in the entry point have no way to reach into singleton state to clear timers, leaving the process unable to exit cleanly under load tests, CI runs, or graceful drains.Implementers register themselves with
ShutdownRegistry.Instance.Register(this)(typically in their constructor) and provide aShutdown()that releases the resource synchronously or returns a promise. The registry calls each implementer exactly once perShutdownAll()invocation.