
#include <boost/thread/thread.hpp> #include <boost/thread/xtime.hpp> #include <Windows.h>//for sleep void ExecuteThread() { for(;;) { boost::xtime time; time.nsec = 0; time.sec = 1; boost::thread::sleep(time); //Sleep(1000); } } int main() { boost::thread thread1(ExecuteThread); boost::thread thread2(ExecuteThread); thread1.join(); thread2.join(); return 0; } When this program is run with Sleep() instead of boost::thread::sleep(), and there are no other cpu intensive programs running, Task Manager shows 99% of the cpu (dual core) is idle. However, when it is run with boost::thread::sleep(), 99% of the cpu is being used by the program! This is a problem because powersaving features no longer work. When this program with boost::thread::sleep() is run with another program that is cpu intensive, Task Manager reports the other program uses 99% of the cpu, so there is no problem there. I am using an overclocked Intel Core 2 Duo 6400 if that matters.