Smart Thread Pool
License
—
Deps
7
Install Size
—
Vulns
✓ 0
Published
Feb 2, 2026
$ dotnet add package Net4x.SmartThreadPoolNet4x.SmartThreadPool is a lightweight, cross-targeted thread pool implementation and utilities intended for desktop and server scenarios where you need more control than the CLR thread-pool provides or where you must support older .NET frameworks.
Authors: Piero Viano
This project provides a flexible thread-pool abstraction with helpers for queuing work items, scheduling delayed or periodic tasks, and controlling worker thread behavior across many target frameworks (including legacy .NET Framework versions). It is useful when you need deterministic task scheduling, custom throttling, or compatibility with older runtimes that don't expose newer concurrency primitives.
The project includes builds that target a wide range of frameworks. Typical TFMs include:
See the project file Net4x.SmartThreadPool.csproj for the exact TFMs produced by this project.
Add a reference to the Net4x.SmartThreadPool project or the built assembly appropriate for your target framework, then queue work items or schedule timers.
Example (conceptual):
// Create or obtain a SmartThreadPool instance (factory or static API may exist)
using(var pool = new Net4x.SmartThreadPool.SmartThreadPool(maxWorkers: 4))
{
// Queue a short-running action
pool.QueueWorkItem(() => {
// do background work
});
// Queue work with a result and wait for completion
var handle = pool.QueueWorkItem(() => ComputeResult());
var result = handle.WaitForResult();
// Schedule a periodic task
var timer = pool.SchedulePeriodic(TimeSpan.FromSeconds(1), () => {
// periodic work
});
// Cancel a queued or running work item if supported
handle.Cancel();
}
Note: The public API surface may vary between TFMs. Check the source types under src/SmartThreadPool for exact type and member names.
dotnet build in the src/SmartThreadPool project directory.Build only the TFMs you need � the repository contains many cross-targeted project configurations.
Unit tests for the SmartThreadPool are located in corresponding test projects under tests/. Use dotnet test for SDK-style projects or run tests from Visual Studio for .NET Framework test projects.
Contributions and bug reports are welcome. Please:
If you want the README to contain exact code samples using the project's real public types and members, I can extract those names from the code and update the examples accordingly.
See the repository LICENSE.txt for licensing details.