Table of Contents

Class UnsafePool<T>

Namespace
Gamelogic.Extensions
Assembly
Gamelogic.Extensions.dll

An unsafe pool class that is used for benchmarking.

public class UnsafePool<T> : IPool<T>

Type Parameters

T
Inheritance
UnsafePool<T>
Implements
Inherited Members
Extension Methods

Remarks

For the most part, this class works similar to Pool<T>, except that it does not keep references to active objects, so when they are released no checks as to their validity is performed. Also, ReleaseAll() is not supported, and DecreaseCapacity(int, bool) cannot drecrease the capacity below the number of currently inactive objects.

In general, you should use a HashPool<T>; this unsafe pool os only very marginally faster.

Constructors

UnsafePool(int, Func<T>, Action<T>, Action<T>, Action<T>)

Properties

ActiveCount

The number of objects that are currently active.

Capacity

The total number of objects in the pool (active and inactive), the maximum number of objects that can be returned by Get().

HasAvailableObject

Returns whether there is an inactive object available to get.

Methods

DecreaseCapacity(int, bool)

Decreases the capacity of the pool.

Get()

Gets a new object from the pool.

IncreaseCapacity(int)

Increases the capacity of the pool.

Release(T)

Returns the object to the pool.

ReleaseAll()