コード例 #1
0
 public Pool(int capacity, Action <T> recycler)
 {
     if (recycler == null)
     {
         throw new ArgumentNullException("recycler");
     }
     _id       = RuntimeUniqueIdProdiver.GetNextId();
     _entries  = new FixedSizeQueue <T>(capacity);
     _recycler = recycler;
 }
コード例 #2
0
ファイル: Transact.Needle.cs プロジェクト: lin5/Theraot
 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();
 }
コード例 #3
0
ファイル: Transact.Needle.cs プロジェクト: lin5/Theraot
            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();
            }
コード例 #4
0
 public Pool(int capacity)
 {
     _id       = RuntimeUniqueIdProdiver.GetNextId();
     _entries  = new FixedSizeQueue <T>(capacity);
     _recycler = GC.KeepAlive;
 }