Ejemplo n.º 1
0
    public static void GiveUntilFull <T>(this IPool <T> pool, IFactory <T> factory)
    {
        Contracts.Requires.That(pool != null);
        Contracts.Requires.That(pool.BoundedCapacity != Capacity.Unbounded);
        Contracts.Requires.That(factory != null);

        var count = (pool.BoundedCapacity - pool.AvailableCount).ClampLower(0);

        pool.GiveMany(factory.CreateMany(count));
    }