如何使用信号处理程序中断sleep()?
解决方法
来自sleep()函数手册页:
The
@H_404_11@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.因此,如果将信号发送到应用程序,则在睡眠调用之后从指令恢复其执行.