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

            activeBatches.Clear();
        }
示例#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);
        }