Table of Contents

Class WorkItemQueue

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

A WorkItemQueue holds work items that are ready to be run, either initially or after some dependency has been satisfied.

public class WorkItemQueue
Inheritance
WorkItemQueue
Inherited Members

Constructors

WorkItemQueue(string, bool, ApartmentState)

Initializes a new instance of the WorkItemQueue class.

public WorkItemQueue(string name, bool isParallel, ApartmentState apartment)

Parameters

name string

The name of the queue.

isParallel bool

Flag indicating whether this is a parallel queue

apartment ApartmentState

ApartmentState to use for items on this queue

Properties

IsEmpty

Get a bool indicating whether the queue is empty.

public bool IsEmpty { get; }

Property Value

bool

IsParallelQueue

Gets a flag indicating whether this queue is used for parallel execution

public bool IsParallelQueue { get; }

Property Value

bool

ItemsProcessed

Gets the total number of items processed so far

public int ItemsProcessed { get; }

Property Value

int

Name

Gets the name of the work item queue.

public string Name { get; }

Property Value

string

State

Gets the current state of the queue

public WorkItemQueueState State { get; }

Property Value

WorkItemQueueState

TargetApartment

Gets the target ApartmentState for work items on this queue

public ApartmentState TargetApartment { get; }

Property Value

ApartmentState

Methods

Dequeue()

Dequeue a WorkItem for processing

public WorkItem? Dequeue()

Returns

WorkItem

A WorkItem or null if the queue has stopped

Enqueue(WorkItem)

Enqueue a WorkItem to be processed

public void Enqueue(WorkItem work)

Parameters

work WorkItem

The WorkItem to process

Pause()

Pause the queue for restarting later

public void Pause()

Start()

Start or restart processing of items from the queue

public void Start()

Stop()

Signal the queue to stop

public void Stop()