KestrunRunspacePoolManager class
Manages a pool of PowerShell runspaces for efficient reuse and resource control.
public sealed class KestrunRunspacePoolManager : IDisposable
Public Members
| name | description |
|---|---|
| KestrunRunspacePoolManager(…) | Initializes a new instance of the KestrunRunspacePoolManager class with the specified minimum and maximum runspaces, initial session state, and thread options. |
| Host { get; } | KestrunHost is needed for logging, config, etc. |
| MaxRunspaces { get; } | Gets the maximum number of runspaces allowed in the pool. |
| MinRunspaces { get; } | Gets the minimum number of runspaces maintained in the pool. |
| ThreadOptions { get; set; } | Thread‑affinity strategy for future runspaces. Default is ReuseThread. |
| Acquire() | Borrow a runspace (creates one if under the cap). |
| AcquireAsync(…) | Asynchronously acquires a runspace from the pool, creating a new one if under the cap, or waits until one becomes available. |
| Dispose() | Disposes the runspace pool manager and all pooled runspaces. |
| Release(…) | Returns a runspace to the pool for reuse, or disposes it if the pool has been disposed. |
See Also
- namespace Kestrun.Scripting