コード例 #1
0
 internal InternalPartitionEnumerator(IEnumerator <TSource> sharedReader, Partitioner.Shared <long> sharedIndex, Partitioner.Shared <bool> hasNoElementsLeft, object sharedLock, Partitioner.Shared <int> activePartitionCount, Partitioner.DynamicPartitionerForIEnumerable <TSource> .InternalPartitionEnumerable enumerable, int maxChunkSize) : base(sharedReader, sharedIndex, maxChunkSize)
 {
     this.m_hasNoElementsLeft    = hasNoElementsLeft;
     this.m_sharedLock           = sharedLock;
     this.m_enumerable           = enumerable;
     this.m_activePartitionCount = activePartitionCount;
     Interlocked.Increment(ref this.m_activePartitionCount.Value);
 }
コード例 #2
0
 internal InternalPartitionEnumerable(IEnumerator <TSource> sharedReader, int maxChunkSize)
 {
     this.m_sharedReader         = sharedReader;
     this.m_sharedIndex          = new Partitioner.Shared <long>(-1L);
     this.m_hasNoElementsLeft    = new Partitioner.Shared <bool>(false);
     this.m_sharedLock           = new object();
     this.m_activePartitionCount = new Partitioner.Shared <int>(0);
     this.m_maxChunkSize         = maxChunkSize;
 }
コード例 #3
0
 protected DynamicPartitionEnumerator_Abstract(TSourceReader sharedReader, Partitioner.Shared <long> sharedIndex, int maxChunkSize)
 {
     this.m_sharedReader = sharedReader;
     this.m_sharedIndex  = sharedIndex;
     if (maxChunkSize == -1)
     {
         this.m_maxChunkSize = Partitioner.DynamicPartitionEnumerator_Abstract <TSource, TSourceReader> .s_defaultMaxChunkSize;
     }
     else
     {
         this.m_maxChunkSize = maxChunkSize;
     }
 }
コード例 #4
0
            public bool MoveNext()
            {
                int num;

                if (this.m_localOffset == null)
                {
                    this.m_localOffset       = new Partitioner.Shared <int>(-1);
                    this.m_currentChunkSize  = new Partitioner.Shared <int>(0);
                    this.m_doublingCountdown = 3;
                }
                if (this.m_localOffset.Value < (this.m_currentChunkSize.Value - 1))
                {
                    this.m_localOffset.Value += 1;
                    return(true);
                }
                if (this.m_currentChunkSize.Value == 0)
                {
                    num = 1;
                }
                else if (this.m_doublingCountdown > 0)
                {
                    num = this.m_currentChunkSize.Value;
                }
                else
                {
                    num = Math.Min(this.m_currentChunkSize.Value * 2, this.m_maxChunkSize);
                    this.m_doublingCountdown = 3;
                }
                this.m_doublingCountdown--;
                if (this.GrabNextChunk(num))
                {
                    this.m_localOffset.Value = 0;
                    return(true);
                }
                return(false);
            }
コード例 #5
0
 internal InternalPartitionEnumerator(IList <TSource> sharedReader, Partitioner.Shared <long> sharedIndex) : base(sharedReader, sharedIndex)
 {
 }
コード例 #6
0
 internal InternalPartitionEnumerable(IList <TSource> sharedReader)
 {
     this.m_sharedReader = sharedReader;
     this.m_sharedIndex  = new Partitioner.Shared <long>(-1L);
 }
コード例 #7
0
 protected DynamicPartitionEnumeratorForIndexRange_Abstract(TSourceReader sharedReader, Partitioner.Shared <long> sharedIndex) : base(sharedReader, sharedIndex)
 {
 }
コード例 #8
0
 protected DynamicPartitionEnumerator_Abstract(TSourceReader sharedReader, Partitioner.Shared <long> sharedIndex) : this(sharedReader, sharedIndex, -1)
 {
 }