public IPointInfo CreatePoint(int jobNumber, int parentNumber) { var jobInfo = _taskDictionary[jobNumber]; HostInfo target = null; bool targetChosen = false; while (!targetChosen) { if (jobInfo.IsCancelled) { return(null); } jobInfo.NeedsPoint = true; if (jobInfo == GetTheMostUrgentTask()) { lock (_syncRoot) { target = GetTargetHost(); //may return null } } if (target == null) { Thread.Sleep(100); } else { targetChosen = true; } } PointInfo p = new PointInfo(target, parentNumber); lock (_syncRoot) { jobInfo.AddPoint(p); } return(p); }
public IPointInfo CreatePoint(int jobNumber, int parentNumber) { var jobInfo = _taskDictionary[jobNumber]; HostInfo target = null; bool targetChosen = false; while (!targetChosen) { if (jobInfo.IsCancelled) { return null; } jobInfo.NeedsPoint = true; if (jobInfo == GetTheMostUrgentTask()) { lock (_syncRoot) { target = GetTargetHost(); //may return null } } if (target == null) { Thread.Sleep(100); } else { targetChosen = true; } } PointInfo p = new PointInfo(target, parentNumber); lock (_syncRoot) { jobInfo.AddPoint(p); } return p; }