ObjectPool

Description

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

Derived from

ObjectPoolBase abstract

Extended by

ByteBufferPool sealed

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

See also

SimpleObjectPool

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


public method Clear → ()

Clears the object pool.

Clear​Thread​Safe


[ThreadSafe]
public method ClearThreadSafe → ()

Clears the object pool.

Get


public method Get → ()

returns → T

The pooled object.

Fetches a pooled object.

Get​Thread​Safe


[ThreadSafe]
public method GetThreadSafe → ()

returns → T

The pooled object.

Fetches a pooled object.

Put


public method Put → (1)

obj in : T

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

Puts the given pooled object back.

Put​Thread​Safe


[ThreadSafe]
public method PutThreadSafe → (1)

obj in : T

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

Puts the given pooled object back.