C++ 睡眠函数 std::this_thread::sleep_for 让嵌入式系统在休眠后继续进行工作
在嵌入式系统中,时间管理是非常重要的。有时候,我们需要在程序执行期间暂停一段时间,然后再继续执行其他任务。C++ 标准库提供了 std::this_thread::sleep_for 函数,可以让程序在指定的时间段内休眠,并在休眠结束后继续执行其他任务。
std::this_thread::sleep_for 函数的原型如下:
template<class Rep, class Period>
void sleep_for(