示例#1
0
        public bool TryAdd(DataBlock item)
        {
            bool result = false;

            if (!IsCompleted && this.dataQueue.Count <= BoundedCapacity)
            {
                this.dataQueue.Enqueue(item);
                result = true;
                CanTake.Set();
            }
            return(result);
        }
        public bool TryAdd(DataBlock block)
        {
            bool result = false;

            if (this.dataDictionary.Count <= BoundedCapacity && !IsCompleted)
            {
                result = this.dataDictionary.TryAdd(block.Index, block);
                CanTake.Set();
            }

            return(result);
        }