예제 #1
0
 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));
 }