In a single-threaded console application, people often use Thread.Sleep as a lazy way to pause the application for some time.
This question raised interesting points about NOT using this approach: Why Thread.Sleep is so harmful
However, not knowing that โSleepโ blocks the current thread, I donโt understand how it works - for example, does it maximize the processor core in a narrow cycle or does it really stop the thread?
More importantly for me, how does a console application respond to various exit scenarios of applications (CTRL-C, kill, window close button) when they get into the middle of sleep? Will he blindly continue execution until the power of the OS kills him, or will he behave well?
source share