public Pool(int capacity, Action <T> recycler) { if (recycler == null) { throw new ArgumentNullException("recycler"); } _id = RuntimeUniqueIdProdiver.GetNextId(); _entries = new FixedSizeQueue <T>(capacity); _recycler = recycler; }
public Needle(T value, ICloner <T> cloner, IEqualityComparer <T> comparer) : base(value) { if (ReferenceEquals(cloner, null)) { throw new ArgumentNullException("cloner"); } _cloner = cloner; _comparer = comparer ?? EqualityComparer <T> .Default; _needleLock = new NeedleLock <Thread>(Context); _id = RuntimeUniqueIdProdiver.GetNextId(); }
public Needle(T value, IEqualityComparer <T> comparer) : base(value) { _cloner = CloneHelper <T> .GetCloner(); if (ReferenceEquals(_cloner, null)) { throw new InvalidOperationException("Unable to get a cloner for " + typeof(T)); } _comparer = comparer ?? EqualityComparer <T> .Default; _needleLock = new NeedleLock <Thread>(Context); _id = RuntimeUniqueIdProdiver.GetNextId(); }
public Pool(int capacity) { _id = RuntimeUniqueIdProdiver.GetNextId(); _entries = new FixedSizeQueue <T>(capacity); _recycler = GC.KeepAlive; }