/// <summary> Process the queue. </summary> protected override void ProcessQueue() { // Endless loop unless aborted while (ThreadRunState != ThreadRunStates.Abort) { // Calculate sleep time based on incoming command speed //_queueSpeed.SetCount(Queue.Count); //_queueSpeed.CalcSleepTime(); EventWaiter.Wait(1000); // Process queue unless stopped if (ThreadRunState == ThreadRunStates.Start) { // Only actually sleep if there are no commands in the queue //if (Queue.Count == 0) _queueSpeed.Sleep(); var dequeueCommand = DequeueCommand(); if (dequeueCommand != null) { CmdMessenger.HandleMessage(dequeueCommand); } } //else //{ // _queueSpeed.Sleep(); //} } }
/// <summary> Process the queue. </summary> protected override void ProcessQueue() { // Endless loop while (ThreadRunState == ThreadRunStates.Start) { _queueSpeed.SetCount(Queue.Count); _queueSpeed.CalcSleepTime(); _queueSpeed.Sleep(); var dequeueCommand = DequeueCommand(); if (dequeueCommand != null) { CmdMessenger.HandleMessage(dequeueCommand); } } }
/// <summary> Process the queue. </summary> protected override void ProcessQueue() { // Endless loop while (ThreadRunState == ThreadRunStates.Start) { // Calculate sleep time based on incoming command speed _queueSpeed.SetCount(Queue.Count); _queueSpeed.CalcSleepTime(); // Only actually sleep if there are no commands in the queue if (Queue.Count == 0) { _queueSpeed.Sleep(); } var dequeueCommand = DequeueCommand(); if (dequeueCommand != null) { CmdMessenger.HandleMessage(dequeueCommand); } } }