I am running an epoll loop and sometimes my call to epoll_wait returns -1 with errno set to EINTR. Sometimes, I want this to end the epoll loop, like in the case of SIGTERM or SIGINT. But I have this code compiled with the -pg flag, so periodic SIGPROF (27) signals are raised that stop my loop.
So... is it possible to switch on the signum so that I can determine when to exit vs. continue? I would like to avoid anything that employs the use of a global to keep track of the most recent signal fired.
Add signal handlers on SIGTERM and SIGINT. Inside those handlers you set a variable that you check in your main epoll loop