在 C/C++ 中是否有可能“放弃”线程的 CPU 时间?例如:
void wait(int s) //Low cpu usage { int tmp = time(); while(tmp + CLOCKS_PER_SEC * s > time()) __AbandonCPUTime(); //Tell cpu to do sth else. }
我试过 Sleep(0),但它不起作用。
c c++ cpu
c ×1
c++ ×1
cpu ×1