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); }
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(); }