コード例 #1
0
 public virtual int CfRunLoopStart()
 {
     if (this.taskRun != null)
     {
         if (!this.taskRun.Wait(100))
         {
             return(0);                        //正在工作
         }
     }
     //the CfRun is loop function
     this.taskRun = CtkTask.RunOnce((ct) => { this.CfRunLoop(); });
     return(0);
 }
コード例 #2
0
        public void NonStopRunStart()
        {
            this.NonStopRunStop();
            this.runningTask = CtkTask.RunOnce(() =>
            {
                //TODO: 重啟時, 會有執行緒被中止的狀況
                while (!this.disposed)
                {
                    try
                    {
                        this.ConnectTryStart();
                    }
                    catch (Exception ex) { CtkLog.Write(ex); }

                    Thread.Sleep(this.IntervalTimeOfConnectCheck);
                }
            });
        }
コード例 #3
0
        public void NonStopRunStart()
        {
            NonStopRunStop();

            this.runningTask = CtkTask.RunOnce((ct) =>
            {
                while (!this.disposed && !ct.IsCancellationRequested)
                {
                    ct.ThrowIfCancellationRequested();
                    try
                    {
                        this.ConnectTry();
                    }
                    catch (Exception ex) { CtkLog.Write(ex); }
                    Thread.Sleep(this.IntervalTimeOfConnectCheck);
                }
            });
        }