Пример #1
0
        void Construct(
            Type concreteType,
            IProvider provider,
            DiContainer container,
            int initialSize,
            PoolExpandMethods expandMethod)
        {
            Assert.That(concreteType.DerivesFromOrEqual <TContract>());

            _expandMethod  = expandMethod;
            _provider      = provider;
            _concreteType  = concreteType;
            _injectContext = new InjectContext(container, concreteType);

            _inactiveItems = new Stack <TContract>(initialSize);

            for (int i = 0; i < initialSize; i++)
            {
                _inactiveItems.Push(AllocNew());
            }
        }
Пример #2
0
 public MemoryPoolSettings(int initialSize, int maxSize, PoolExpandMethods expandMethod)
 {
     InitialSize  = initialSize;
     MaxSize      = maxSize;
     ExpandMethod = expandMethod;
 }
Пример #3
0
 public MemoryPoolSettings()
 {
     InitialSize  = 0;
     MaxSize      = int.MaxValue;
     ExpandMethod = PoolExpandMethods.OneAtATime;
 }