如何使用信号处理程序中断 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/