Show / Hide Table of Contents

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>
Implements
IObjectPool<T>
Namespace: Eco.Shared.Pools
Assembly: Eco.Shared.dll
Syntax
public class ThreadSafePool<T> : Object, IObjectPool<T> where T : class
Type Parameters
Name Description
T

Constructors

ThreadSafePool()

Declaration
public ThreadSafePool()

Properties

Count

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32

Methods

Get()

Declaration
public T Get()
Returns
Type Description
T

TryAdd(T)

Declaration
public bool TryAdd(T obj)
Parameters
Type Name Description
T obj
Returns
Type Description
System.Boolean

Implements

IObjectPool<T>

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾