Gemstone Threading Library
Show/Hide TOC

# DoubleBufferedQueue T Class

A thread-safe double-buffered queue that allows for low-contention item processing in single-producer, single-consumer scenarios.

## Definition

Namespace: Gemstone.Threading.Collections
Assembly: Gemstone.Threading (in Gemstone.Threading.dll) Version: 1.0.178 -- Release Build+fee762453958015ddc78d695a89062c7a981318e
C#
View Source Request Example

    public class DoubleBufferedQueue<T>

VB
View Source Request Example

    Public Class DoubleBufferedQueue(Of T)

C++
View Source Request Example

    generic<typename T>
    public ref class DoubleBufferedQueue

JavaScript
View Source Request Example

    JavaScript does not support generic types or methods.

Inheritance
  Object DoubleBufferedQueueT

#### Type Parameters

T
  Type of items being queued.

## Remarks

It is not safe to use this class with multiple consumer threads. The Dequeue method must be called by one thread at a time, and the consumer must not access a list returned by Dequeue after its next call to Dequeue.

## Constructors

DoubleBufferedQueueT | Creates a new instance of the DoubleBufferedQueueT class.

## Properties

Count | Gets the current number of items in the queue.
ProcessItemsFunction | Gets or sets item processing function.

## Methods

Clear | Empties the producer's buffer so that the items can no longer be consumed by the consumer.
Dequeue | Dequeues a collection of items from the queue.
Enqueue | Enqueues a collection of items into the double-buffered queue.
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object)
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object)
GetHashCode | Serves as the default hash function. (Inherited from Object)
GetType | Gets the Type of the current instance. (Inherited from Object)
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object)
ToString | Returns a string that represents the current object. (Inherited from Object)
TryClear | Attempts to enqueue a collection of items into the double-buffered queue.
TryDequeue | Attempts to dequeue a collection of items from the queue and returns the number of items left in the queue after dequeuing.
TryEnqueue | Attempts to enqueue a collection of items into the double-buffered queue.

## Events

ProcessException | Event that is raised if an exception is encountered while attempting to processing an item in the AsyncQueueT.

## See Also

#### Reference

Gemstone.Threading.Collections Namespace