
I had a code that consist of a thread that was heavily CPU intensive. And i need to limit it's execution so that it's CPU usage should not go above a particular limit, irrespective of the hardware/processor over which the program was running. Moreover we often come across a problem, in which we need to Sleep() a thread for a particular duration of time. Such kind of code often consist of a loop, doing some kind of processing/repetitive polling and sleeping at the end of loop for some time, to save CPU cycles. This goes on and on until the loop is terminated.
|