Class WorkItemQueue
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
stringThe name of the queue.
isParallel
boolFlag indicating whether this is a parallel queue
apartment
ApartmentStateApartmentState to use for items on this queue
Properties
IsEmpty
Get a bool indicating whether the queue is empty.
public bool IsEmpty { get; }
Property Value
IsParallelQueue
Gets a flag indicating whether this queue is used for parallel execution
public bool IsParallelQueue { get; }
Property Value
ItemsProcessed
Gets the total number of items processed so far
public int ItemsProcessed { get; }
Property Value
Name
Gets the name of the work item queue.
public string Name { get; }
Property Value
State
Gets the current state of the queue
public WorkItemQueueState State { get; }
Property Value
TargetApartment
Gets the target ApartmentState for work items on this queue
public ApartmentState TargetApartment { get; }
Property Value
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
WorkItemThe 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()