c++ - 中断 sleep() 函数

标签 c++

如何使用信号处理程序中断 sleep()?

最佳答案

来自 sleep() 函数手册页:

The sleep() function suspends execution of the calling thread until either seconds seconds have elapsed or a signal is delivered to the thread and its action is to invoke a signal-catching function or to terminate the thread or process. System activity may lengthen the sleep by an indeterminate amount.

因此,如果向应用程序发送了一个信号,它的执行将从 sleep 调用后的指令恢复。

关于c++ - 中断 sleep() 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3157295/

相关文章:

c++ - 枚举和开关 block 哪里出错了

c++ - 在 C++ 中填充 protobuf 字段

c++ - 在 OpenCV 中分配矩阵元素

c++ - 如何根据单个用户定义的文字自动添加文字定义?

c++ - std::set with string key 和潜在的效率损失

c++ - "addin.XLL is in a different format"问题,无法打开自己创建的xll

C++:char** 到 const char** 的转换

c++ - 将 QVideoFrame 转换为 QImage

c++ - 带有运算符的好奇重复模板

c++ - 如何修复 xychart.cpp 中的 "index < m_series->count()"错误?