예제 #1
0
        /// <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();
        }
예제 #2
0
 public DebugView(AsyncConditionVariable acv)
 {
     this.acv = acv;
 }