Class QueuePool<T>
Object pool for System.Collections.Generic.Queue<> instances.
Implements
Inherited Members
Namespace: System.Collections.Generic
Assembly: Nuqleon.Memory.dll
Syntax
public abstract class QueuePool<T> : ObjectPoolBase<PooledQueue<T>>, IObjectPool<PooledQueue<T>>, IObjectPoolAllocateFree<PooledQueue<T>>, IObjectPoolNew<PooledQueue<T>>
Type Parameters
Name | Description |
---|---|
T | Specifies the type of elements in the queue. |
Constructors
QueuePool(Int32)
Creates a new System.Collections.Generic.Queue<> pool of the specified pool size.
Declaration
protected QueuePool(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Collections.Generic.Queue<> instances to keep in the pool. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Methods
Create(Int32)
Creates a new System.Collections.Generic.Queue<> pool of the specified pool size. The pool creates new instances of System.Collections.Generic.Queue<> by calling the default constructor on Queue{T}.
Declaration
public static QueuePool<T> Create(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Collections.Generic.Queue<> instances to keep in the pool. |
Returns
Type | Description |
---|---|
QueuePool<T> | Newly created pool for System.Collections.Generic.Queue<> instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Create(Int32, Int32)
Creates a new System.Collections.Generic.Queue<> pool of the specified pool size.
The pool creates new instances of System.Collections.Generic.Queue<> by calling the constructor on System.Collections.Generic.Queue<>, passing in the specified capacity
.
Declaration
public static QueuePool<T> Create(int size, int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Collections.Generic.Queue<> instances to keep in the pool. |
System.Int32 | capacity | The initial number of elements that the System.Collections.Generic.Queue<> can contain. |
Returns
Type | Description |
---|---|
QueuePool<T> | Newly created pool for System.Collections.Generic.Queue<> instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Create(Int32, Int32, Int32)
Creates a new System.Collections.Generic.Queue<> pool of the specified pool size.
The pool creates new instances of System.Collections.Generic.Queue<> by calling the constructor on System.Collections.Generic.Queue<>, passing in the specified capacity
.
Declaration
public static QueuePool<T> Create(int size, int capacity, int maxCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Collections.Generic.Queue<> instances to keep in the pool. |
System.Int32 | capacity | The initial number of elements that the System.Collections.Generic.Queue<> can contain. |
System.Int32 | maxCapacity | The maximum capacity allowed for pooled instances. |
Returns
Type | Description |
---|---|
QueuePool<T> | Newly created pool for System.Collections.Generic.Queue<> instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
New()
Gets a holder to a pooled queue instance with RAII capabilities to return it to the pool.
Declaration
public PooledQueueHolder<T> New()
Returns
Type | Description |
---|---|
PooledQueueHolder<T> | Holder to a pooled queue instance. |