epoll_wait and signals
Q: My epoll_wait fails due to EINTR (SIGUSR1)
A: Certain signal handler will interrupt epoll_wait(), select() and similar system calls on any Unix or Linux. This is by design so you can interrupt these system calls.
You cannot directly remedy it. The typical solution is to explicitly check the errno for EINTR and to execute epoll_wait() again:
int nr; do { nr = epoll_wait(epfd, events, maxevents, timeout); } while (nr < 0 && errno == EINTR);
source: https://stackoverflow.com/questions/6870158/epoll-wait-fails-due-to-eintr-how-to-remedy-this/6870391#6870391
and from here https://stackoverflow.com/questions/2252981/gdb-error-unable-to-execute-epoll-wait-4-interrupted-system-call
"You should check the epoll_wait return value, then if it's -1 compare errno to EINTR and, if so, retry the system call. This is usually done with continue in a loop."