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>(); }
public StackPool(InitPooled <T, TParam> init, ReturnToPoll <T> done) { _init = init ?? throw new ArgumentNullException(nameof(init)); _done = done; }
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)); }
public static IPool <T, TParam> ThreadUnsafe <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null) { return(new StackPool <T, TParam>(init, done)); }
public static IPool <T, TParam> ThreadSafe <T, TParam>(InitPooled <T, TParam> init, ReturnToPoll <T> done = null) { return(Concurrent(init, done)); }
/// <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)); }