Ejemplo n.º 1
0
            public override IList <IEnumerator <KeyValuePair <long, TSource> > > GetOrderablePartitions(int partitionCount)
            {
                if (partitionCount <= 0)
                {
                    throw new ArgumentOutOfRangeException("partitionCount");
                }
                IEnumerator <KeyValuePair <long, TSource> >[] array      = new IEnumerator <KeyValuePair <long, TSource> > [partitionCount];
                IEnumerable <KeyValuePair <long, TSource> >   enumerable = new Partitioner.DynamicPartitionerForIEnumerable <TSource> .InternalPartitionEnumerable(this.m_source.GetEnumerator(), this.m_maxChunkSize);

                for (int i = 0; i < partitionCount; i++)
                {
                    array[i] = enumerable.GetEnumerator();
                }
                return(array);
            }
Ejemplo n.º 2
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);
 }