Пример #1
0
        /// <summary>
        /// 待機
        /// </summary>
        /// <param name="timeout">タイムアウト (msec) [-1,0~]</param>
        /// <returns>
        ///		停止を検知すると true を返します。
        ///		タイムアウトすると false を返します。
        /// </returns>
        public virtual bool Wait(int timeout)
        {
            var watch = new DSLab.CxStopwatch();

            watch.Start();
            while (IsRunning)
            {
                watch.Stop();
                if (0 <= timeout && timeout <= watch.Elapsed)
                {
                    return(false);
                }
                System.Threading.Thread.Sleep(1);
            }
            return(true);
        }
Пример #2
0
 /// <summary>
 /// 待機
 /// </summary>
 /// <param name="timeout">タイムアウト (msec) [-1,0~]</param>
 /// <returns>
 ///		停止を検知すると true を返します。
 ///		タイムアウトすると false を返します。
 /// </returns>
 public virtual bool Wait(int timeout)
 {
     var watch = new DSLab.CxStopwatch();
     watch.Start();
     while(IsRunning)
     {
         watch.Stop();
         if (0 <= timeout && timeout <= watch.Elapsed)
             return false;
         System.Threading.Thread.Sleep(1);
     }
     return true;
 }