-
Notifications
You must be signed in to change notification settings - Fork 7
Callback
ZjzMisaka edited this page Apr 19, 2024
·
9 revisions
The callback feature allows developers to set callbacks for tasks using the parameters of QueueWorkItem or WorkOption. The default callback can be set using PowerPoolOption.DefaultCallback. The callback returns an ExecuteResult object with the following properties:
ID: Represents the ID of the work.
Result: Represents the result of the work.
Status: Indicates whether the work succeeded or failed.
Exception: If the work failed, this property contains the associated exception.
QueueDateTime: Queue datetime.
StartDateTime: Start datetime.
EndDateTime: End datetime.
powerPool.QueueWorkItem(() =>
{
return 100;
}, (res) =>
{
string id = res.ID;
int result = res.Result;
Exception exception = res.Exception;
Status status = res.Status;
// Do something
});
powerPool.PowerPoolOption = new PowerPoolOption()
{
DefaultCallback = (res) =>
{
// Do something
},
};
- 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