X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=main.cpp;h=0564e27e8a2a865e1ea9e0f62cf7bc622c27c5d4;hp=2af1996fe670d7152c81552e00018f17052f3aac;hb=5ab36b04b0c12058394335e891398c494df513d2;hpb=656d6863b47e1791a310397d88e25fa897e05012 diff --git a/main.cpp b/main.cpp index 2af1996..0564e27 100644 --- a/main.cpp +++ b/main.cpp @@ -94,7 +94,7 @@ void *acceptor_thread_run(void *arg) pfd.events = POLLIN; int nfds = poll(&pfd, 1, 50); - if (nfds == 0 || (nfds == -1 && errno == EAGAIN)) { + if (nfds == 0 || (nfds == -1 && errno == EINTR)) { continue; } if (nfds == -1) { @@ -187,7 +187,7 @@ sleep: int left_to_sleep = parms->stats_interval; do { left_to_sleep = sleep(left_to_sleep); - } while (left_to_sleep > 0); + } while (left_to_sleep > 0 && !hupped); } return NULL; } @@ -433,11 +433,13 @@ int main(int argc, char **argv) gettimeofday(&serialize_start, NULL); if (!stats_file.empty()) { + pthread_kill(stats_thread, SIGHUP); if (pthread_join(stats_thread, NULL) == -1) { perror("pthread_join"); exit(1); } } + pthread_kill(acceptor_thread, SIGHUP); if (pthread_join(acceptor_thread, NULL) == -1) { perror("pthread_join"); exit(1);