Cancelling a BackgroundWorker
问题 My DoWork for backgroundworker1 sets a wait timer via a class WakeUp , it works well. The problem right now is that sometimes my while CancellationPending is ending in an infinite loop. So inside DoWork there is a call to WaitOne , the DoWork sets the wait timer stuff and waits the thread until the timer triggers. I need for the BackgroundWorker to shut down right away but as well I have to keep a reference to BackgroundWorker so I can keep track of each alarm in my program. Why is