Esempio n. 1
0
        public void FreeAll()
        {
            foreach (var batch in activeBatches)
            {
                inactiveBatches.Push(batch);
                BatchDeactivated?.Invoke(batch);
            }

            activeBatches.Clear();
        }
Esempio n. 2
0
        public void Free(Batch batch)
        {
            if (!activeBatches.Remove(batch))
            {
                throw new InvalidOperationException(
                          $"Can only free batches currently allocated with {nameof(AllocateBatch)}.");
            }

            inactiveBatches.Push(batch);

            BatchDeactivated?.Invoke(batch);
        }