Table of Contents

Class ParallelWorkItemDispatcher

Namespace
NUnit.Framework.Internal.Execution
Assembly
nunit.framework.dll

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 int

Number of workers to use

Properties

LevelOfParallelism

Number of parallel worker threads

public int LevelOfParallelism { get; }

Property Value

int

Queues

Enumerates all the Queues supported by the dispatcher

public IEnumerable<WorkItemQueue> Queues { get; }

Property Value

IEnumerable<WorkItemQueue>

Shifts

Enumerates all the shifts supported by the dispatcher

public IEnumerable<WorkShift> Shifts { get; }

Property Value

IEnumerable<WorkShift>

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 WorkItem

The 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

ShiftChangeEventHandler

ShiftStarting

Event raised whenever a shift is starting.

public event ShiftChangeEventHandler? ShiftStarting

Event Type

ShiftChangeEventHandler