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); }
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); } }); }
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); } }); }