Visual Reference

Execution Flow Diagrams

Four SVG diagrams showing the exact decision paths for each bounded-wait mechanism.

01 — RunspacePool Acquisition Timeout REQ-04 ↗
Invoke(input, settings) pool.BeginGetRunspace() async → IAsyncResult AsyncWaitHandle.WaitOne(timeout) calling thread blocks elapsed? yes TimeoutException caller receives → no EndGetRunspace() acquire slot → results normal return
02 — Single-Runspace Invoke / Phase 2 REQ-02 ↗
Invoke(input, settings) pool == null Timeout == ∞ ? yes DoWork() same thread zero overhead no Task.Run(DoWork) ThreadPool/MTA task.Wait(timeout) done? no CoreStop() [async] throw TimeoutException yes → results
03 — Stop(TimeSpan) Flow REQ-05 ↗
Stop(TimeSpan timeout) ObjectDisposed? yes swallow no-op return CoreStop(true, null, null) signal stop async AsyncWaitHandle.WaitOne(timeout) expired? yes TimeoutException no State = Stopped
04 — Parallel StopPipelines REQ-06 ↗
Close() / Dispose() StopPipelines(30s) snapshot active pipelines Task.Run(pipeline₁.Stop()) Task.Run(pipeline₂.Stop()) · · · N tasks simultaneously · · · Task.WaitAll(tasks, 30s) O(30s) wall-clock regardless of N all done? no TimeoutException yes all pipelines stopped