I have what is currently a single-threaded console app which does something every 30s... e.g.
while(exitFlagNotSet)
{
doStuff();
Thread.Sleep(30000);
}
However I'd also like to listen for application-exit a bit along the lines of Capture console exit C#. In such a situation I can't wait 30s - my app will be forcibly terminated after 5s IIRC.
So is there a way to refactor my approach so the 30s wait may be aborted when something occurs? I've done this kind of thing in C++ but don't know what the terminology and techniques are in C#/.net