Class ParallelWorkItemDispatcher
ParallelWorkItemDispatcher handles execution of work items by queuing them for worker threads to process.
public class ParallelWorkItemDispatcher : IWorkItemDispatcher
- Inheritance
-
ParallelWorkItemDispatcher
- Implements
- Inherited Members
Constructors
ParallelWorkItemDispatcher(int)
Construct a ParallelWorkItemDispatcher
public ParallelWorkItemDispatcher(int levelOfParallelism)
Parameters
levelOfParallelism
intNumber of workers to use
Properties
LevelOfParallelism
Number of parallel worker threads
public int LevelOfParallelism { get; }
Property Value
Queues
Enumerates all the Queues supported by the dispatcher
public IEnumerable<WorkItemQueue> Queues { get; }
Property Value
Shifts
Enumerates all the shifts supported by the dispatcher
public IEnumerable<WorkShift> Shifts { get; }
Property Value
Methods
CancelRun(bool)
Cancel the ongoing run completely. If no run is in process, the call has no effect.
public void CancelRun(bool force)
Parameters
force
bool
Dispatch(WorkItem)
Dispatch a single work item for execution. The first work item dispatched is saved as the top-level work item and used when stopping the run.
public void Dispatch(WorkItem work)
Parameters
work
WorkItemThe item to dispatch
Start(WorkItem)
Start execution, setting the top level work, enqueuing it and starting a shift to execute it.
public void Start(WorkItem topLevelWorkItem)
Parameters
topLevelWorkItem
WorkItem
Events
ShiftFinished
Event raised whenever a shift has ended.
public event ShiftChangeEventHandler? ShiftFinished
Event Type
ShiftStarting
Event raised whenever a shift is starting.
public event ShiftChangeEventHandler? ShiftStarting