MS has been saying that Sleep(0) causes a thread to relinquish the remainder of its time slice, probably for ever. I've tested that on every version of Windows, probably since Win95 and, it does NOT. That is simply and provably NOT true. It didn't work that way even on NT4.
The easiest way to write a supposedly "well behaved" application is to put a call to Sleep(0) in a loop that breaks on some way in the future condition and watch one core go to 100% utilization _every_ time. Sleep(0) is bad news (unless you want the program to consume an entire core, then it's made to order.)
@whoever wants to see what Sleep() really does:
Some time ago I posted a little test program that shows how Sleep() behaves (including source). Anyone interested can find that test program (and a few others in the archive) at
https://forum.lazarus.freepascal.org/index.php/topic,52973.msg391376.html#msg391376Also, as @PascalDragon indicated, Sleep() is most definitely not a substitute for processing messages. Sleep() tells the O/S not to schedule the thread for X amount of time, that's very different thing than what takes place when an application calls GetMessage.
One thing a programmer should keep in mind when reading documentation: documentation is the way it's supposed to work (IOW, what the programmer who wrote it dreamed) it isn't necessarily the way it _actually_ works.