/// <summary> /// <see cref="BalancingStaticPoolManager{TElem}"/> constructor /// </summary> /// <param name="comparer">Comparer which will be used to select the best element from pool</param> /// <param name="name">Name for the current <see cref="BalancingStaticPoolManager{TElem}"/> instance</param> /// <param name="destroyAction">The action that will be performed to destroy each element after removal ('null' means no action)</param> public BalancingStaticPoolManager(PoolElementComparer <TElem> comparer, string name, Action <TElem> destroyAction) { _name = name ?? this.GetType().GetCSFullName(); _destroyAction = destroyAction; _comparer = comparer ?? PoolElementComparer <TElem> .CreateDefault(); _elementsContainer = new PrioritizedElementsContainer <TElem>(_comparer); _stoppedEvent = new ManualResetEventSlim(false); _disposeCancellation = new CancellationTokenSource(); Profiling.Profiler.ObjectPoolCreated(this.Name); }
/// <summary> /// <see cref="BalancingStaticPoolManager{TElem}"/> constructor /// </summary> public BalancingStaticPoolManager() : this(PoolElementComparer <TElem> .CreateDefault(), null, null) { }