Table of Contents

Class CoalescingQueueDispatchExtensions

Namespace
CounterpointCollective.Collections
Assembly
CounterpointCollective.CoalescingQueue.dll
public static class CoalescingQueueDispatchExtensions
Inheritance
CoalescingQueueDispatchExtensions
Inherited Members

Methods

UseAsynchronousDispatch(ICoalescingQueue)

Configures the coalescing queue to process completed nodes asynchronously on the thread pool.

public static void UseAsynchronousDispatch(this ICoalescingQueue queue)

Parameters

queue ICoalescingQueue

Remarks

When using this dispatch mode:

  • Node callbacks are never executed on the thread that completes the node.
  • All processing is scheduled on the thread pool, allowing the calling thread to continue immediately.
  • This mode is useful when node processing may be long-running or when you want to avoid blocking the producer.

UseInlineFirstThenAsyncDispatch(ICoalescingQueue)

Configures the coalescing queue to process the first completed node synchronously on the calling thread, and then process any remaining completed nodes asynchronously on the thread pool.

public static void UseInlineFirstThenAsyncDispatch(this ICoalescingQueue queue)

Parameters

queue ICoalescingQueue

Remarks

This dispatch mode is useful when:

  • You want the first completed node to be handled immediately to reduce latency.
  • You want to avoid long-running synchronous processing blocking the caller when multiple nodes complete rapidly.
If the callback for the first node contains await expressions, its synchronous execution proceeds up to the first yield; after that, its continuation will happen on the thread pool.

UseSynchronousDispatch(ICoalescingQueue)

Configures the coalescing queue to process completed nodes synchronously on the calling thread.

public static void UseSynchronousDispatch(this ICoalescingQueue queue)

Parameters

queue ICoalescingQueue

Remarks

This dispatch mode is useful when:

  • Node processing is lightweight and you want to avoid the overhead of scheduling work on the thread pool.
  • You want to minimize latency for processing completed nodes.
If a callback contains await expressions, the processing executes synchronously up to the first yield; after that, its continuation and the dispatching of any other nodes that complete while processing is ongoing will be scheduled on the thread pool.