Thread.Interrupt to stop long sleep at app shutdown - Is there a better approach
I'm having a small background thread which runs for the applications lifetime - however when the application is shutdown, the thread should exit gracefully. The problem is that the thread runs some code at an interval of 15 minutes - which means it sleeps ALOT. Now in order to get it out of sleep, I toss an interrupt at it - my question is however, if there's a better approach to this, since interrupts generate ThreadInterruptedException. Here's the gist of my code (somewhat pseudo): public class BackgroundUpdater : IDisposable { private Thread myThread; private const int intervalTime = 900000