]> git.sesse.net Git - cubemap/blobdiff - input.cpp
Explicitly SIGHUP threads to kill them out of syscalls when we want to join them...
[cubemap] / input.cpp
index 47c3c0193472d8cfa56747fd2461cdf5595632cd..ccc4bc0134e47870ae5e44f7f5c9210d897260bd 100644 (file)
--- a/input.cpp
+++ b/input.cpp
@@ -11,6 +11,7 @@
 #include <sys/socket.h>
 #include <netdb.h>
 #include <poll.h>
+#include <signal.h>
 #include <errno.h>
 #include <vector>
 #include <string>
@@ -128,6 +129,7 @@ void Input::stop()
 {
        should_stop = true;
 
+       pthread_kill(worker_thread, SIGHUP);
        if (pthread_join(worker_thread, NULL) == -1) {
                perror("pthread_join");
                exit(1);
@@ -269,7 +271,7 @@ void Input::do_work()
                        pfd.events |= POLLRDHUP;
 
                        int nfds = poll(&pfd, 1, 50);
-                       if (nfds == 0 || (nfds == -1 && errno == EAGAIN)) {
+                       if (nfds == 0 || (nfds == -1 && errno == EINTR)) {
                                continue;
                        }
                        if (nfds == -1) {