コード例 #1
0
        /// <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();
                //}
            }
        }
コード例 #2
0
        /// <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);
                }
            }
        }
コード例 #3
0
        /// <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);
                }
            }
        }