MeatMotion

LinkedPool<T>

Store pooled objects using links in the objects themselves. TryPush and TryPop return false on contention.

Namespace
MeatMotion.Collections
Assembly
MeatMotion

Jump to members

public struct LinkedPool<T>
    where T : class, ILinkedPoolNode<T>
MotionCollections.cs · L55

Members

Size

Number of nodes currently stored in the pool.

public readonly int Size { get; }

TryPush

Push an unlinked node at the head. Null, linked nodes or contention return false.

public bool TryPush(T item)
Parameters and return value
item
T Entry operated on by the collection.
Returns
bool

TryPop

Remove and unlink the head node. Return false if empty or contended.

public bool TryPop(out T result)
Parameters and return value
result
out T Receives the popped node.
Returns
bool