How can 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With