PowerThreadPool 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PowerThreadPool --version 1.0.0
                    
NuGet\Install-Package PowerThreadPool -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PowerThreadPool" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PowerThreadPool" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PowerThreadPool" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PowerThreadPool --version 1.0.0
                    
#r "nuget: PowerThreadPool, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PowerThreadPool@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PowerThreadPool&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PowerThreadPool&version=1.0.0
                    
Install as a Cake Tool

PowerThreadPool

<img src="https://www.nuget.org/Content/gallery/img/logo-header.svg?sanitize=true" height="30px">

Enables efficient ThreadPool management. Features task queuing, thread control, and customizable concurrent execution. Supports diverse task submissions for complex concurrency requirements.

Download

PowerThreadPool is available as Nuget Package now.

Getting started

Without callback
PowerPool powerPool = new PowerPool(new ThreadPoolOption() { MaxThreads = 3 });
powerPool.QueueWorkItem(() => 
{
    // DO SOMETHING
    return result;
});
With callback
PowerPool powerPool = new PowerPool(new ThreadPoolOption() { MaxThreads = 3 });
powerPool.QueueWorkItem(() => 
{
    // DO SOMETHING
    return result;
}, (res) => 
{
    // this callback of thread
    // running result: res.Result
});
Stop all threads
powerPool.Stop();
Blocks the calling thread until all of the threads terminates.
powerPool.Wait();
Pause threads
PowerPool powerPool = new PowerPool(new ThreadPoolOption());
string id = powerPool.QueueWorkItem(() => 
{
    while (true)
    {
        // Pause here when user call Pause()
        powerPool.PauseIfRequested();
        // DO SOMETHING
    }
    return result;
});
// DO SOMETHING
powerPool.Pause(id); // Pause by ID
powerPool.Pause(); // Pause all running thread
powerPool.Resume(true); // Resume all thread
API
string QueueWorkItem(Action action, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem(Action<object[]> action, object[] param, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1>(Action<T1> action, T1 param1, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1, T2>(Action<T1, T2> action, T1 param1, T2 param2, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1, T2, T3>(Action<T1, T2, T3> action, T1 param1, T2 param2, T3 param3, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1, T2, T3, T4>(Action<T1, T2, T3, T4> action, T1 param1, T2 param2, T3 param3, T4 param4, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5> action, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, Action<ExcuteResult<object>> callBack = null)
string QueueWorkItem<T1, TResult>(Func<T1, TResult> function, T1 param1, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<T1, T2, TResult>(Func<T1, T2, TResult> function, T1 param1, T2 param2, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<T1, T2, T3, TResult>(Func<T1, T2, T3, TResult> function, T1 param1, T2 param2, T3 param3, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, TResult> function, T1 param1, T2 param2, T3 param3, T4 param4, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, TResult> function, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<TResult>(Func<TResult> function, Action<ExcuteResult<TResult>> callBack = null)
string QueueWorkItem<TResult>(Func<object[], TResult> function, object[] param, Action<ExcuteResult<TResult>> callBack = null)
void Wait()
async Task WaitAsync()
void Stop()
async Task StopAsync()
void PauseIfRequested()
public void Pause()
void Resume(bool resumeThreadPausedById = false)
void Pause(string id)
void Resume(string id)
void Cancel()
bool Cancel(string id)
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PowerThreadPool:

Package Downloads
aadog.RedisTagLock

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.5.1 245 11/30/2025
5.5.0 172 11/23/2025
5.4.0 390 11/18/2025
5.3.0 153 11/15/2025
5.2.0 137 11/1/2025
5.1.1 163 10/24/2025
5.1.0 156 10/17/2025
5.0.0 218 10/10/2025
5.0.0-rc.2 113 10/3/2025
5.0.0-rc.1 134 9/29/2025
4.22.7 188 9/20/2025
4.22.6 316 9/17/2025
4.22.5 190 9/7/2025
4.22.4 434 9/3/2025
4.22.3 216 8/31/2025
4.22.2 227 8/28/2025
4.22.1 238 8/26/2025
4.22.0 179 8/19/2025
4.21.1 198 8/11/2025
4.21.0 542 7/21/2025
4.20.3 123 7/18/2025
4.20.2 177 7/15/2025
4.20.1 251 7/13/2025 4.20.1 is deprecated because it has critical bugs.
4.20.0 456 6/18/2025
4.19.0 210 6/17/2025
4.18.3 412 6/10/2025
4.18.2 219 5/29/2025
4.18.1 300 5/16/2025
4.18.0 210 5/8/2025
4.17.0 217 4/27/2025
4.16.4 251 3/20/2025
4.16.3 261 3/3/2025
4.16.2 194 2/21/2025
4.16.1 235 2/4/2025
4.16.0 216 1/19/2025
4.15.0 221 1/3/2025
4.14.2 204 12/18/2024
4.14.1.1 194 12/13/2024
4.14.1 191 12/13/2024 4.14.1 is deprecated because it has critical bugs.
4.14.0 214 12/4/2024
4.13.0 209 11/14/2024
4.12.1 224 11/9/2024
4.12.0 225 10/16/2024
4.11.1 222 9/29/2024
4.11.0 204 9/24/2024
4.10.0 281 9/18/2024
4.9.1 239 9/1/2024
4.9.0 230 8/24/2024
4.8.2 221 8/18/2024
4.8.1 206 7/27/2024
4.8.0 225 7/21/2024
4.7.0 215 7/18/2024
4.6.0 217 6/30/2024
4.5.1 248 5/29/2024
4.5.0 205 5/24/2024
4.4.0 178 5/20/2024
4.3.0 197 5/16/2024
4.2.0 201 5/13/2024
4.1.0 212 5/11/2024
4.0.4 223 5/9/2024
4.0.3 308 5/5/2024
4.0.2 242 5/4/2024
4.0.1 213 4/27/2024
4.0.0 199 4/24/2024
3.2.0 205 4/22/2024
3.1.0 203 4/20/2024
3.0.0 214 4/18/2024
2.5.11 224 4/15/2024
2.5.10 226 4/12/2024
2.5.9 199 4/8/2024
2.5.8 253 3/26/2024
2.5.7 235 3/22/2024
2.5.6 212 3/12/2024
2.5.5 260 3/2/2024
2.5.4 215 2/29/2024
2.5.3 234 2/29/2024
2.5.2 243 2/26/2024
2.5.1 226 2/25/2024
2.5.0 244 2/8/2024
2.4.0 270 12/5/2023
2.3.0 178 12/5/2023
2.2.3 209 12/4/2023
2.2.2 171 12/3/2023
2.2.1 212 11/21/2023
2.2.0 175 11/12/2023
2.1.4 172 11/11/2023
2.1.3 178 11/11/2023
2.1.2 169 11/11/2023
2.1.1 173 11/6/2023
2.1.0 167 11/5/2023
2.0.1 229 10/23/2023
2.0.0 195 10/22/2023
1.5.10 231 9/24/2023
1.5.9 216 9/24/2023
1.5.8 214 9/18/2023
1.5.7 198 9/17/2023
1.5.6 229 9/8/2023
1.5.5 227 9/7/2023
1.5.4 229 9/6/2023
1.5.3 238 9/5/2023
1.5.2 220 9/4/2023
1.5.1 243 9/3/2023
1.5.0 218 9/2/2023
1.4.5 215 9/1/2023
1.4.4 229 9/1/2023
1.4.3 210 8/31/2023
1.4.2 213 8/30/2023
1.4.1 332 8/30/2023 1.4.1 is deprecated because it has critical bugs.
1.4.0 272 8/30/2023 1.4.0 is deprecated because it has critical bugs.
1.3.2 264 8/29/2023
1.3.1 228 8/28/2023
1.3.0 233 8/28/2023
1.2.1 233 8/28/2023
1.2.0 246 8/27/2023
1.1.0 264 8/27/2023
1.0.2 246 8/26/2023
1.0.1 246 8/26/2023
1.0.0 241 8/26/2023