-
Notifications
You must be signed in to change notification settings - Fork 16
Work Group
ZjzMisaka edited this page Oct 17, 2025
·
18 revisions
A Group can be set for a work using WorkOption.Group.
powerPool.QueueWorkItem(() =>
{
// Do something
}, new WorkOption()
{
Group = "GroupName"
});This way, the execution of works can be controlled in batches through the already set group.
powerPool.GetGroup("GroupName").Wait();
powerPool.Wait(powerPool.GetGroupMemberList("GroupName"));PowerPool.GetGroup(string groupName) will return a group object, which have funcions for control the works belonging to the group.
[Get only]
Group name
string Name;The group object has the following functions for group control, similar to the pool and work control.
| name | summary | result |
|---|---|---|
| Add(WorkID workID) | Add work to group. | Returns false if the work does not exist. Modifies WorkOption.Group. |
| Remove(WorkID workID) | Remove work from group. | Returns false if work does not exist, or if the work does not belong to the group |
| Wait(bool helpWhileWaiting = false) | Wait until all the work belonging to the group is done. | |
| Wait(CancellationToken cancellationToken, bool helpWhileWaiting = false) | Wait until all the work belonging to the group is done. | |
| WaitAsync(bool helpWhileWaiting = false) | Wait until all the work belonging to the group is done. | |
| WaitAsync(CancellationToken cancellationToken, bool helpWhileWaiting = false) | Wait until all the work belonging to the group is done. | |
| Fetch(bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| Fetch(CancellationToken cancellationToken, bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| Fetch(bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| Fetch(CancellationToken cancellationToken, bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| Fetch(Func<ExecuteResult, bool> predicate, bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| FetchAsync(bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| FetchAsync(CancellationToken cancellationToken, bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| FetchAsync(bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| FetchAsync(CancellationToken cancellationToken, bool removeAfterFetch = false, bool helpWhileWaiting = false) | Fetch the work result. | Return a list of work result |
| Stop() | Stop all the work belonging to the group. | Return false if no thread running |
| ForceStop() | Force stop all the work belonging to the group. | Return false if no thread running |
| Pause() | Pause all the work belonging to the group. | Return a list of IDs for work that doesn't exist |
| Resume() | Resume all the work belonging to the group. | Return a list of IDs for work that doesn't exist |
| Cancel() | Cancel all the work belonging to the group. | Return a list of IDs for work that doesn't exist |
- Sync | Async
- Pool Control | Work Control
- Divide And Conquer
- Thread Pool Sizing
- Work Callback | Default Callback
- Rejection Policy
- 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 | Deque | Custom)
- Load Balancing
- Low-Contention Design
Core
Results
Options