예제 #1
0
 public MergeSortTask(int[] array, int start, int end, MergeSortTask parent)
 {
     m_array   = array;
     m_start   = start;
     m_end     = end;
     m_parent  = parent;
     m_counter = 2;
 }
예제 #2
0
 public void Execute(Processor processor)
 {
     if (m_end - m_start > 128)
     {
         int           middle = (m_start + m_end) / 2;
         MergeSortTask left   = new MergeSortTask(m_array, m_start, middle, this);
         MergeSortTask right  = new MergeSortTask(m_array, middle + 1, m_end, this);
         processor.EnqueueTask(left);
         processor.EnqueueTask(right);
     }
     else
     {
         MergeSort.Sort(m_array, m_start, m_end);
         SignalTaskDone(processor);
     }
 }