BatchWorker Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
General pattern for an asynchronous worker that performs a work task, when notified, to service queued work. Each work cycle handles ALL the queued work. If new work arrives during a work cycle, another cycle is scheduled. The worker never executes more than one instance of the work cycle at a time, and consumes no resources when idle. It uses TaskScheduler.Current to schedule the work cycles.
public abstract class BatchWorker
type BatchWorker = class
Public MustInherit Class BatchWorker
- Inheritance
-
BatchWorker
- Derived
Constructors
BatchWorker() |
Fields
lockable |
Properties
CancellationToken |
Gets or sets the cancellation used to cancel this batch worker. |
Methods
IsIdle() |
Check if this worker is idle. |
Notify() |
Notify the worker that there is more work. |
Notify(DateTime) |
Instructs the batch worker to run again to check for work, if
it has not run again already by then, at specified |
NotifyAndWaitForWorkToBeServiced() |
Notify the worker that there is more work, and wait for the current work cycle, and also the next work cycle if there is currently unserviced work. |
WaitForCurrentWorkToBeServiced() |
Wait for the current work cycle, and also the next work cycle if there is currently unserviced work. |
Work() |
Implement this member in derived classes to define what constitutes a work cycle |