Work Group
ZjzMisaka edited this page May 11, 2024
·
5 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.
name | summary | result |
---|---|---|
Wait() | Wait until all the work belonging to the group is done. | |
WaitAsync() | Wait until all the work belonging to the group is done. | |
Stop(bool forceStop = false) | 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 |