Exemplo n.º 1
0
 public TaskControl()
 {
     FSM         = new FSMDef();
     ScanfTime   = new ScanfTime(1000);
     LogicThread = new Thread(RunLogic);
     LogicThread.IsBackground = true;
     LogicThread.Priority     = ThreadPriority.Highest;
     LogicThread.Start();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 最外面的while循环体,循环跑当前列表任务
        /// </summary>
        private void RunLogic()
        {
            DateTime time = DateTime.Now;

            while (_exitThread == false)
            {
                lock (logicTasks)
                {
                    foreach (var item in logicTasks)
                    {
                        item.Run();
                    }
                }

                double spedntime = (DateTime.Now - time).TotalMilliseconds;
                time = DateTime.Now;
                ScanfTime.Add(spedntime);

                HzControl.Communal.Tools.ThreadSleep.Sleep(ref spad);
            }
        }