A valuable answer will include the rpg code that does something like this
volatile bool interrupted;
main() {
sigaction(SIG_ALARM, myhandler) // register handler
alarm(3) // set the alarm
sleep(5) // blocking call, sleep just as an example.
alarm(0) // disable the alarm
}
myHandler() {
interrupted=true
}
I think you've got the idea. I have a code that blocks, similar to sleep, and I want an alarm to unlock the blocking call
Another question, after the alarm handler has finished, where does the execution point goes ? does it terminate the program ?, can I call another method while inside myHandler() ? Is it allowed, how can I keep doing something before the program finishes, like log to a table till where did I went ?
Thank you very much !