-
Notifications
You must be signed in to change notification settings - Fork 6
Getting Started
ZjzMisaka edited this page Sep 8, 2023
·
9 revisions
PowerThreadPool is available as Nuget Package now.
PowerPool powerPool = new PowerPool(new PowerPoolOption() { /* Some options */ });
string id = powerPool.QueueWorkItem(() =>
{
// DO SOMETHING
});
PowerPool powerPool = new PowerPool(new PowerPoolOption() { /* Some options */ });
powerPool.QueueWorkItem(() =>
{
// DO SOMETHING
return result;
}, (res) =>
{
// Callback of the work
});
PowerPool powerPool = new PowerPool(new PowerPoolOption() { /* Some options */ });
powerPool.QueueWorkItem(() =>
{
// DO SOMETHING
return result;
}, new WorkOption()
{
// Some options
});
The QueueWorkItem function accepts a variety of work types, including Action and Func delegates. These delegates can be parameterized with different amounts of arguments, and can optionally include a callback function or a WorkOption object. The types of works that this thread pool API accepts are as follows:
Action<T1>
Action<T1, T2>
Action<T1, T2, T3>
Action<T1, T2, T3, T4>
Action<T1, T2, T3, T4, T5>
Action
Action<object[]>
Func<T1, TResult>
Func<T1, T2, TResult>
Func<T1, T2, T3, TResult>
Func<T1, T2, T3, T4, TResult>
Func<T1, T2, T3, T4, T5, TResult>
Func<TResult>
Func<object[], TResult>
- Pool Control | Work Control
- Thread Pool Sizing
- Work Callback | Default Callback
- Parallel Execution
- Work Priority | Thread Priority
- Error Handling
- Work Timeout | Cumulative Work Timeout
- Work Dependency
- Work Group
- Events
- Runtime Status
- Running Timer
- Queue Type (FIFO | LIFO | Custom)
- Load Balancing
- Lock-Free
Core
Results
Options