Exemple #1
0
        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);
        }
Exemple #2
0
        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;
        }