Class QueueAsyncChunkHandler<TWorkItem, TChunkProcessor>
Owner of the thread processing the queue on behalf of
Inheritance
Inherited Members
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public class QueueAsyncChunkHandler<TWorkItem, TChunkProcessor> : AsynchronousHandler<TChunkProcessor, Queue<TWorkItem>> where TChunkProcessor : QueueAsyncChunkProcessor<TWorkItem>, new()
Type Parameters
Name | Description |
---|---|
TWorkItem | The type that is in the queue |
TChunkProcessor | The processor that processes a chunk of the queue. |
Remarks
The handler is designed to be used with
Constructors
QueueAsyncChunkHandler()
Default constructor
Declaration
public QueueAsyncChunkHandler()
Remarks
The handler is designed to be used with
Properties
QueueLength
Obtain the length of the queue
Declaration
public int QueueLength { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
The handler is designed to be used with
Methods
Enqueue(TWorkItem)
Add a work item to the queue for processing.
Declaration
public bool Enqueue(TWorkItem workItem)
Parameters
Type | Name | Description |
---|---|---|
TWorkItem | workItem | The item to add to the queue for processing. |
Returns
Type | Description |
---|---|
Boolean | True if successfully added to the queue. False if the chunk processor has completed processed its queue and has or is about to die. |
Remarks
The handler is designed to be used with
ScheduleNewWork()
Start the thread and start processing the chunk.
Declaration
protected override void ScheduleNewWork()
Overrides
Remarks
The handler is designed to be used with
ThreadDelegate(AsyncContext, Object)
The actual thread perform processing.
Declaration
protected void ThreadDelegate(AsyncContext context, object argument)
Parameters
Type | Name | Description |
---|---|---|
AsyncContext | context | Context of the thread. |
Object | argument | Unused empty argument. |
Remarks
The handler is designed to be used with