Handle EINTR in epoll_wait().
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 7 Apr 2013 15:46:32 +0000 (17:46 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 7 Apr 2013 15:46:32 +0000 (17:46 +0200)
server.cpp

index 7e4352276ea1b2d1db6a84f88bae5e76239b0824..e26a85b3361f257da8756b78b5ef03783148c1d3 100644 (file)
@@ -140,6 +140,9 @@ void Server::do_work()
 {
        for ( ;; ) {
                int nfds = epoll_wait(epoll_fd, events, EPOLL_MAX_EVENTS, EPOLL_TIMEOUT_MS);
+               if (nfds == -1 && errno == EINTR) {
+                       continue;
+               }
                if (nfds == -1) {
                        perror("epoll_wait");
                        exit(1);