Class StackPool

Public

Lightweight Stack Pool.

Handy class for pooling stacks of type T.

Usage:

  • Claim a new stack usingStack<SomeClass> foo = StackPool<SomeClass>.Claim ();

  • Use it and do stuff with it

  • Release it withStackPool<SomeClass>.Release (foo);

You do not need to clear the stack before releasing it. After you have released a stack, you should never use it again.

Warning

This class is not thread safe

Since

Version 3.2

Public Static Methods

Claim ()

Claim a stack.

Clear ()

Clears all pooled stacks of this type.

GetSize ()

Number of stacks of this type in the pool.

Release (stack)

Releases a stack.

Warmup (count)

Makes sure the pool contains at least count pooled items.

Private/Protected Members

Static constructor.

pool

Internal pool.

Private Static Readonly