Ejemplo n.º 1
0
 void IMergeHelper <TInputOutput> .Execute()
 {
     if (this.m_asyncChannels != null)
     {
         SpoolingTask.SpoolPipeline <TInputOutput, TIgnoreKey>(this.m_taskGroupState, this.m_partitions, this.m_asyncChannels, this.m_taskScheduler);
     }
     else if (this.m_syncChannels != null)
     {
         SpoolingTask.SpoolStopAndGo <TInputOutput, TIgnoreKey>(this.m_taskGroupState, this.m_partitions, this.m_syncChannels, this.m_taskScheduler);
     }
     else if (this.m_ignoreOutput)
     {
         SpoolingTask.SpoolForAll <TInputOutput, TIgnoreKey>(this.m_taskGroupState, this.m_partitions, this.m_taskScheduler);
     }
 }
        //-----------------------------------------------------------------------------------
        // Schedules execution of the merge itself.
        //
        // Arguments:
        //    ordinalIndexState - the state of the ordinal index of the merged partitions
        //

        void IMergeHelper <TInputOutput> .Execute()
        {
            if (m_asyncChannels != null)
            {
                SpoolingTask.SpoolPipeline <TInputOutput, TIgnoreKey>(m_taskGroupState, m_partitions, m_asyncChannels, m_taskScheduler);
            }
            else if (m_syncChannels != null)
            {
                SpoolingTask.SpoolStopAndGo <TInputOutput, TIgnoreKey>(m_taskGroupState, m_partitions, m_syncChannels, m_taskScheduler);
            }
            else if (m_ignoreOutput)
            {
                SpoolingTask.SpoolForAll <TInputOutput, TIgnoreKey>(m_taskGroupState, m_partitions, m_taskScheduler);
            }
            else
            {
                // The last case is a pipelining merge when DOP = 1. In this case, the consumer thread itself will compute the results,
                // so we don't need any tasks to compute the results asynchronously.
                Contract.Assert(m_partitions.PartitionCount == 1);
            }
        }
Ejemplo n.º 3
0
        //-----------------------------------------------------------------------------------
        // Schedules execution of the merge itself.
        //
        // Arguments:
        //    ordinalIndexState - the state of the ordinal index of the merged partitions
        //

        void IMergeHelper <TInputOutput> .Execute()
        {
            if (_asyncChannels != null)
            {
                Debug.Assert(!ParallelEnumerable.SinglePartitionMode);
                SpoolingTask.SpoolPipeline <TInputOutput, TIgnoreKey>(_taskGroupState, _partitions, _asyncChannels, _taskScheduler);
            }
            else if (_syncChannels != null)
            {
                SpoolingTask.SpoolStopAndGo <TInputOutput, TIgnoreKey>(_taskGroupState, _partitions, _syncChannels, _taskScheduler);
            }
            else if (_ignoreOutput)
            {
                SpoolingTask.SpoolForAll <TInputOutput, TIgnoreKey>(_taskGroupState, _partitions, _taskScheduler);
            }
            else
            {
                // The last case is a pipelining merge when DOP = 1. In this case, the consumer thread itself will compute the results,
                // so we don't need any tasks to compute the results asynchronously.
                Debug.Assert(_partitions.PartitionCount == 1);
            }
        }