why sleep?
can't you just use this code instead?
Application.ProcessMessages;
No, I can't. The
Sleep procedure is used to freeze the operation of the program for a specified time, so that the process or single thread does not consume the processor's power. The
ProcessMessages method is used to process messages that are in the queue. As you can see, these are two different things.
Even if we could safely call this method in the side thread, it does not make sense, because in no way will it freeze the thread operation and, at the same time, save the processor's power.
I wrote about the operation of the
Sleep procedure because OP was ”surprised” that calling it with a value of
0 causes a power consumption jump of up to
25% (i.e.
100% of one processor core that executes the thread code), and a call with a value of
1 does not.
However, I wrote about the accuracy of this procedure, because on practically every computer, for the same value of
1, the delay will be different and depend of the default system time period. So if someone uses this procedure with the idea of creating relatively precise delays, he must take into account the mentioned imperfection.
That's what it's _supposed_ to mean.
It's not as easy as it seems. What else to understand what these words mean, and what else to know what they actually mean in practice. And the documentation does not explain this in any way.