Example #1
0
 /// <summary>
 /// 睡眠
 /// </summary>
 /// <param name="time"></param>
 void Sleep(Time_base time)
 {
     if (time.DeltaUnMark().TotalMilliseconds > 1)
     {
         Thread.Sleep(0);
     }
     else
     {
         Thread.Sleep(1);
     }
 }
Example #2
0
 /// <summary>
 /// 睡眠
 /// </summary>
 /// <param name="time"></param>
 void Sleep(Time_base time)
 {
     if (time.DeltaUnMark().TotalMilliseconds > 1)
     {
         Thread.Sleep(0);
     }
     else
     {
         Thread.Sleep(1);
     }
 }
Example #3
0
        /// <summary>
        /// 循环主体
        /// </summary>
        public void Run()
        {
            Time_base time = new Time_base();

            while (IsRunning)
            {
                var dt = time.Delta().TotalMilliseconds;
                ///服务器的工作代码传入距上次执行的时间间隔毫秒数
                Work(dt);

                Sleep(time);
            }
        }
Example #4
0
        /// <summary>
        /// 循环主体
        /// </summary>
        public void Run()
        {
            Time_base time = new Time_base();
            while (IsRunning)
            {
                var dt = time.Delta().TotalMilliseconds;
                ///服务器的工作代码传入距上次执行的时间间隔毫秒数
                Work(dt);

                Sleep(time);
            }

        }