Ejemplo n.º 1
0
 protected override void Process(ThreadController myController)
 {
     while (JobCount != 0)
     {
         if (myController.threadsNeedMoreWork())
         {
             if (myController.hasWaitingJobs())
             {
                 myController.HandItemsToThreadsLoop();
             }
             else
             {
                 //Substitute Jobs we're waiting to finish.
                 RunAll(myController);
                 myController.HandItemsToThreadsLoop();
             }
         }
         else
         {
             Run();
         }
     }
 }
Ejemplo n.º 2
0
        public void Run()
        {
#if DEBUG
            if (!FirstRun)
            {
                for (int i = 0; i < mySystemsSchedulerTree.RowHeight; i++)
                {
                    Debug.WriteLine("Row: " + i);
                    foreach (Engine.Systems.System A in mySystemsSchedulerTree.GetSystemRow(i))
                    {
                        Debug.WriteLine(A.GetType().ToString());
                    }
                    Debug.WriteLine("");
                }
                FirstRun = true;
            }
#endif


            for (int i = 0; i < mySystemsSchedulerTree.RowHeight; i++)
            {
                foreach (Engine.Systems.System A in mySystemsSchedulerTree.GetSystemRow(i))
                {
                    A.Preprocess();
                    A.Run(mYController);
                }//Starts running our threads
                while (!mYController.isIdle())
                {
                    mYController.HandItemsToThreadsLoop(); //sets up next thread controll count.
                    int g = 0;
                    while (!mYController.threadsNeedMoreWork() && g < myInterimSystems.Count)
                    {
                        if (myInterimSystems[g].JobCount != 0)
                        {
                            myInterimSystems[g].Run(mYController);
                        }
                        else
                        {
                            g++;
                        }
                    }
                }
                foreach (Engine.Systems.System A in mySystemsSchedulerTree.GetSystemRow(i))
                {
                    A.Postprocess();
                }
            }
        }