ObjectPool

Description

class Tinman.Core.System.ObjectPool
<T ref : IMemoryConsumption>

Derived from

ObjectPoolBase abstract
IObjectPoolGet<T>

Extended by

ByteBufferPool sealed

A thread-safe object pool that is capable of properly pooling IDisposable object.

See also

ObjectPoolUtil

Public / Constructors

Object​Pool


public constructor ObjectPool → (5)

name in : string

[not-empty]
The name of this object pool.

factory in : IObjectPoolFactory<T>

[not-null]
The pool object factory to use.

maximumCount opt : int32 = 0

[>=0]
Maximum number of pooled objects to hold. Set to 0 to disable.

maximumMemory opt : int32 = 0

[>=0]
Maximum memory to hold with pooled objects (estimated). Set to 0 to disable.

monitor opt : Monitor own = null

The monitor object to use for synchronization or null to use a private instance.

Creates a new instance of ObjectPool.

Public / Methods

Clear​Thread​Safe


[ThreadSafe]
public method ClearThreadSafe → ()

The thread-safe version of IObjectPoolBase.Clear.

Get​Thread​Safe


[ThreadSafe]
public method GetThreadSafe → ()

returns → T

The pooled object.

The thread-safe version of IObjectPoolGet.Get.

Put​Thread​Safe


[ThreadSafe]
public method PutThreadSafe → (1)

obj in : T

[not-null]
The pooled object to put back.

The thread-safe version of IObjectPool.Put.

See also

IObjectPool.Put

Public / Attributes

Limit​Count


public attribute LimitCount → (get,set)

value : int32

[>=0]
The limit or 0 if unlimited.

The limit for the maximum number of objects that may be present in the pool.

Limit​Memory


public attribute LimitMemory → (get,set)

value : int64

[>=0]
The limit in bytes or 0 if unlimited.

The limit for the maximum amount of memory consumed by the objects in the pool.