In C++11, you can do this with standard library facilities:
(在C ++ 11中,可以使用标准库工具来执行此操作:)
#include <chrono>
#include <thread>
std::this_thread::sleep_for(std::chrono::milliseconds(x));
Clear and readable, no more need to guess at what units the sleep()
function takes.
(清晰易读,无需再猜测sleep()
函数采用的单位。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…