예제 #1
0
 //将dtu加入到dtu列表中 要求线程安全的
 public void AddTaskItem(BaseDTU item)
 {
     lock (baseDTUList)
     {
         baseDTUList.Add(item);
     }
 }
예제 #2
0
        /// <summary>
        /// 把到来的实际dtu下分到具体的BaseTimer中
        /// </summary>
        /// <param name="baseDTU"></param>
        public void AddDTU(BaseDTU baseDTU)
        {
            object o = new object();

            lock (o)
            {
                //计算新的baseDTU应该被放置在哪一个BaseTimer中
                int tempIndex = (int)(index++) % baseTimerList.Count;
                baseTimerList.ElementAt(tempIndex).AddTaskItem(baseDTU);
            }
        }
예제 #3
0
        public void RemoveDTU(BaseDTU baseDTU)
        {
            object o = new object();

            lock (o)
            {
                foreach (BaseTimer basetimer in baseTimerList)
                {
                    basetimer.RemoveTaskItem(baseDTU);
                }
            }
        }
예제 #4
0
 public void RemoveTaskItem(BaseDTU item)
 {
     baseDTUList.Remove(item);
 }