/// <summary> /// 启动此调度器 /// </summary> public void Start() { if (StatusFlag == -1) { throw new InvalidOperationException("JobScheduler已释放"); } else if (StatusFlag != 0) { throw new InvalidOperationException("当前状态不可用 请先调用Finish()并等待其完成"); } CancelBits = new SyncBit32Map(0); ExecuteThread = new System.Threading.Thread(Loop); ExecuteThread.Name = "Job执行"; ExecuteThread.Start(); }
/// <summary> /// 在job执行线程启动后,job执行循环开始前 /// </summary> protected virtual void PreJobLoop() { JobQueue = new SyncQueue <TJob>(); CancelBits = new SyncBit32Map(0); }