The Old New Thing

The dangers of sleeping on a UI thread

If you have a thread that owns a window, you should not be using the function, because that causes your thread to stop responding to messages for the duration of the sleep. This is true even for sleeps of short duration, such as sleeping for a few seconds and waking up in order to poll the state of something in the system. As we noted ...