/// <summary> /// /// </summary> /// <param name="collection"></param> /// <param name="maxCount"></param> public AsyncProducerConsumerQueue(IEnumerable <T> collection, int maxCount) { if (0 >= maxCount) { throw new ArgumentOutOfRangeException(nameof(maxCount)); } queue = null == collection ? new Queue <T>() : new Queue <T>(collection); if (queue.Count > maxCount) { throw new ArgumentException(); } this.maxCount = maxCount; mutex = new AsyncLock(); notFull = new AsyncConditionVariable(mutex); completedOrNotEmpty = new AsyncConditionVariable(mutex); completed = new CancellationTokenSource(); }
public DebugView(AsyncConditionVariable acv) { this.acv = acv; }