5 ms·
Whether the CPU is busy because of a loop with a sleep depends on the ration of the sleep time and the time to perform the rest of one loop iteration. Doing stu
by funcDropShadow 2y ago
Whether the CPU is busy because of a loop with a sleep depends on the ration of the sleep time and the time to perform the rest of one loop iteration. Doing stuff in a loop iteration that takes 1min and then adding a ms sleep will not drop CPU usage a measurable amount.
- account42 2y agoThe question is about waiting, i.e. when you have no real work to do. If you have significant work to do then there is no point in sleeping until that work is done.