Interrupt sleep() function
How can开发者_如何学C I interrupt sleep() using a signal handler?
From sleep()
function man page:
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.
So, if a signal is send to the application, its execution is resumed from the instruction after the sleep call.
精彩评论