public void Start() { if (_status == QueueStatus.None || _status == QueueStatus.Stoped) { //set status to starting _status = QueueStatus.Starting; Debugger.AddMsg("Start Queue " + this.Name); //Init Task Pool TaskPool_Init(); //Raise Event Started Started?.Invoke(this, EventArgs.Empty); //set status to started _status = QueueStatus.Started; Debugger.AddMsg("Start Queue " + this.Name + " Successfully."); } else { throw new InvalidOperationException("Queue status must None when start queue"); } }
public void Stop() { if (_status == QueueStatus.Started) { Debugger.AddMsg("Stop Queue " + this.Name); //set status to stopping _status = QueueStatus.Stopping; while (_jobList.Count > 0) { //sleep 100ms when has job Thread.Sleep(100); } //Raise Event Started this.Stopped?.Invoke(this, EventArgs.Empty); //set status to started _status = QueueStatus.Started; Debugger.AddMsg("Stop Queue " + this.Name + " Successfully."); } else { throw new InvalidOperationException("Queue status must None when start queue"); } }
public void DebuggerTest() { Debugger debugger = new Debugger(true); for (int i = 0; i < 10000; i++) { debugger.AddMsg(i.ToString()); } debugger.Dispose(); Assert.IsTrue(true); }