public ProducerConsumerPool(InitPooled <T, TParam> init, ReturnToPoll <T> done,
                             IProducerConsumerCollection <T> storage = null)
 {
     _init    = init ?? throw new ArgumentNullException(nameof(init));
     _done    = done;
     _storage = storage ?? new ConcurrentBag <T>();
 }
示例#2
0
 public StackPool(InitPooled <T, TParam> init, ReturnToPoll <T> done)
 {
     _init = init ?? throw new ArgumentNullException(nameof(init));
     _done = done;
 }
示例#3
0
 public static IPool <T, TParam> Concurrent <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null, IProducerConsumerCollection <T> storage = null)
 {
     return(new ProducerConsumerPool <T, TParam>(init, done, storage));
 }
示例#4
0
 public static IPool <T, TParam> ThreadUnsafe <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null)
 {
     return(new StackPool <T, TParam>(init, done));
 }
示例#5
0
 public static IPool <T, TParam> ThreadSafe <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null)
 {
     return(Concurrent(init, done));
 }
示例#6
0
 /// <summary>
 /// No pooling, always calls factory and no return
 /// </summary>
 public static IPool <T, TParam> None <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null)
 {
     return(new NullPool <T, TParam>(init, done));
 }