Пример #1
0
        public Dynamic(TaskGraph graph, int?maxThreadCount = null) : base(graph, maxThreadCount)
        {
            this.graph.ComputeSLevel();
            var initialList = this.graph.SortBySLevel().Where(x => x.IsReadyToExecute).ToList();

            readyList = new ReadyTaskList(initialList);
            workers   = new ReadyWorkerList(WorkerCount);
        }
Пример #2
0
        public void ExecuteTask(TaskNode taskNode, ReadyTaskList readyList)
        {
            Console.WriteLine("Worker: " + ID + " started work on task:" + taskNode.ID);

            Thread.Sleep(taskNode.SimulatedExecutionTime);
            taskNode.Status = BuildStatus.Executed;
            readyList.AddNewReadyNodes(taskNode);
            Console.WriteLine("Worker: " + ID + " finished work on task:" + taskNode.ID);
            ReadyStatus = true;
            ReadySignal.Set();
        }