Determine which signal caused the EINTR?

I run the 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, as in the case of SIGTERM or SIGINT. But I have this code compiled with the -pg flag, so there are periodic SIGPROF signals (27) that stop my loop.

So ... is it possible to enable signum so that I can determine when to exit vs. continue? I would like to avoid everything that uses the global to track the most recent signal.

+4
source share
1 answer

Add signal handlers to SIGTERM and SIGINT. Inside these handlers, you set a variable that you check in your main epoll loop

+1
source

All Articles