Class ThreadSafePool<T>
Simple thread-safe System.Collections.Generic.Stack<> based pool implementation. It implements IObjectPool<T> interface and has unlimited pool size.
For optimal performance you should prefer thread-safe lock free FixedSizePool<T>, but it has fixed pool size and can't be shrink or extended.
Inheritance
System.Object
ThreadSafePool<T>
Assembly: Eco.Shared.dll
Syntax
public class ThreadSafePool<T> : Object, IObjectPool<T> where T : class
Type Parameters
Constructors
ThreadSafePool()
Declaration
Properties
Count
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
Get()
Declaration
Returns
TryAdd(T)
Declaration
public bool TryAdd(T obj)
Parameters
Type |
Name |
Description |
T |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Implements
Extension Methods