Class PooledQueue<T>
Represents a first-in, first-out collection of objects. Instances of this type are kept in a pool for recycling.
Inheritance
System.Object
PooledQueue<T>
Namespace: System.Collections.Generic
Assembly: Nuqleon.Memory.dll
Syntax
public class PooledQueue<T> : Queue<T>, IFreeable, IClearable
Type Parameters
Name | Description |
---|---|
T | Specifies the type of elements in the queue. |
Methods
Free()
Frees the object and returns it to the pool.
Declaration
public void Free()
GetInstance()
Gets a System.Collections.Generic.Queue<> instance from the global queue pool.
Declaration
public static PooledQueue<T> GetInstance()
Returns
Type | Description |
---|---|
PooledQueue<T> | A System.Collections.Generic.Queue<> instance obtained from the global pool. |
New()
Gets a pooled System.Collections.Generic.Queue<> instance, from the global pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledQueueHolder<T> New()
Returns
Type | Description |
---|---|
PooledQueueHolder<T> | Pooled queue instance. |
New(QueuePool<T>)
Gets a pooled System.Collections.Generic.Queue<> instance, from the specified pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledQueueHolder<T> New(QueuePool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
QueuePool<T> | pool | Pool to allocate from. |
Returns
Type | Description |
---|---|
PooledQueueHolder<T> | Pooled queue instance. |
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | Thrown if |
Explicit Interface Implementations
IClearable.Clear()
Declaration
void IClearable.Clear()