x4Trace Documentation v1.0
Loading...
Searching...
No Matches
Tools.Dispatch.Dispatcher Class Reference

Represents a dispatcher/buffer. Buffer elements and processes them sequentially on a different thread. More...

Public Member Functions

 Dispatcher (int size)
 Constructor.
 
void Start ()
 Starts the dispatcher.
 
void Stop ()
 Enforce stop of dispatcher.
 
void StopAndProcess ()
 Stops the dispatcher. Processes all unprocessed items.
 
void Enqueue (object obj)
 Enqueue item.
 

Properties

bool IsRunning [get]
 Returns true when the dispatcher is running.
 

Events

Processed Processed = null
 Item has been processed event.
 

Private Member Functions

void ProcessQueue ()
 Process the queue.
 

Private Attributes

int tailIndex = 0
 Latest item index in queue.
 
int headIndex = 0
 Latest processed item in the queue.
 
ManualResetEventSlim wait = new ManualResetEventSlim()
 Wait.
 
object[] queue
 Queue of items.
 
int size = 0
 Size of queue.
 
bool isRunning = false
 The dispatcher is running.
 
Thread processThread
 Process thread.
 

Detailed Description

Represents a dispatcher/buffer. Buffer elements and processes them sequentially on a different thread.

Constructor & Destructor Documentation

◆ Dispatcher()

Tools.Dispatch.Dispatcher.Dispatcher ( int size)

Constructor.

Parameters
sizeSize of queue.

Member Function Documentation

◆ Enqueue()

void Tools.Dispatch.Dispatcher.Enqueue ( object obj)

Enqueue item.

Parameters
objItem to enqueue.

The documentation for this class was generated from the following file: