Click or drag to resize

DoubleBufferedQueueT Class

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

Namespace: GSF.Collections
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public class DoubleBufferedQueue<T>
View Source

Type Parameters

T
Type of items being queued.

The DoubleBufferedQueueT type exposes the following members.

Constructors
 NameDescription
Public methodDoubleBufferedQueueT Creates a new instance of the DoubleBufferedQueueT class.
Top
Properties
 NameDescription
Public propertyCount Gets the current number of items in the queue.
Public propertyProcessItemsFunction Gets or sets item processing function.
Top
Methods
 NameDescription
Public methodClear Empties the producer's buffer so that the items can no longer be consumed by the consumer.
Public methodDequeue Dequeues a collection of items from the queue.
Public methodEnqueue Enqueues a collection of items into the double-buffered queue.
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)
Public methodTryClear Attempts to enqueue a collection of items into the double-buffered queue.
Public methodTryDequeue Attempts to dequeue a collection of items from the queue and returns the number of items left in the queue after dequeuing.
Public methodTryEnqueue Attempts to enqueue a collection of items into the double-buffered queue.
Top
Events
 NameDescription
Public eventProcessException Event that is raised if an exception is encountered while attempting to processing an item in the AsyncQueueT.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
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.
See Also