G
Guest
I have a Queue that contains filenames.
I have a System.Timer with it's interval set to 200.
I load the Queue up with 35.000 files. I start the Timer.
On Timer.Elapsed I take a file from the Queue (.dequeue) and do my business
logic on it.
I use a Windows Forms to control all this. Start button to start the timer
and a Stop button to stop the timer.
But when I press the stop button the application keeps on processing files
in Queue. The time to process a file takes longer then the 200 ms that the
timer is set to. Is this the cause of file processing keeps on going?
Timer.Elapsed has been triggered so many times that the application processes
those even though I have stopped the timer?
How can I stop the processing? By checking in my business logic code if the
timer is enables or not? Is this a 'clean' way to solve this all?
I have a System.Timer with it's interval set to 200.
I load the Queue up with 35.000 files. I start the Timer.
On Timer.Elapsed I take a file from the Queue (.dequeue) and do my business
logic on it.
I use a Windows Forms to control all this. Start button to start the timer
and a Stop button to stop the timer.
But when I press the stop button the application keeps on processing files
in Queue. The time to process a file takes longer then the 200 ms that the
timer is set to. Is this the cause of file processing keeps on going?
Timer.Elapsed has been triggered so many times that the application processes
those even though I have stopped the timer?
How can I stop the processing? By checking in my business logic code if the
timer is enables or not? Is this a 'clean' way to solve this all?