Exemplo n.º 1
0
 /// <summary>
 /// Constructor of the worker array.
 /// </summary>
 /// <param name="prioritizedScheduler">Scheduler, owner of this group.</param>
 public WorkerArray(PrioritizedScheduler prioritizedScheduler, int workerArrayIndex, int threadCount, ThreadPriority systemThreadPriority)
 {
     for (int i = 0; i < m_taskQueuesByPriority.Length; i++)
     {
         m_taskQueuesByPriority[i] = new MyConcurrentQueue <Task>(DEFAULT_QUEUE_CAPACITY);
     }
     m_workerArrayIndex     = workerArrayIndex;
     m_prioritizedScheduler = prioritizedScheduler;
     m_workers = new Worker[threadCount];
     for (int workerIndex = 0; workerIndex < threadCount; workerIndex++) // initialize workers inside the array
     {
         m_workers[workerIndex] = new Worker(this, "Parallel " + systemThreadPriority + "_" + workerIndex, systemThreadPriority);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor of the worker array.
 /// </summary>
 /// <param name="prioritizedScheduler">Scheduler, owner of this group.</param>
 public WorkerArray(PrioritizedScheduler prioritizedScheduler, int workerArrayIndex, int threadCount, ThreadPriority systemThreadPriority)
 {
     for (int i = 0; i < m_taskQueuesByPriority.Length; i++)
     {
         m_taskQueuesByPriority[i] = new MyConcurrentQueue<Task>(DEFAULT_QUEUE_CAPACITY);
     }
     m_workerArrayIndex = workerArrayIndex;
     m_prioritizedScheduler = prioritizedScheduler;
     m_workers = new Worker[threadCount];
     for (int workerIndex = 0; workerIndex < threadCount; workerIndex++) // initialize workers inside the array
     {
         m_workers[workerIndex] = new Worker(this, "Parallel " + systemThreadPriority + "_" + workerIndex, systemThreadPriority);
     }
 }