]> git.sesse.net Git - cubemap/blobdiff - thread.cpp
Replace all perror() calls with our own log calls.
[cubemap] / thread.cpp
index b263be649147e5f44952e1a3161bb6a5fb989e68..f719eacb95c5379a2d664f23c49c04e0b50b767b 100644 (file)
@@ -5,6 +5,7 @@
 #include <signal.h>
 #include <errno.h>
 
+#include "log.h"
 #include "thread.h"
        
 Thread::~Thread() {}
@@ -14,7 +15,7 @@ void Thread::run()
        should_stop = false;
        int pipefd[2];
        if (pipe2(pipefd, O_CLOEXEC) == -1) {
-               perror("pipe");
+               log_perror("pipe");
                exit(1);
        }
        stop_fd_read = pipefd[0];
@@ -32,7 +33,7 @@ void Thread::stop()
        } while (err == -1 && errno == EINTR);
 
        if (err == -1) {
-               perror("write");
+               log_perror("write");
                exit(1);
        }
 
@@ -41,13 +42,13 @@ void Thread::stop()
        } while (err == -1 && errno == EINTR);
 
        if (err == -1) {
-               perror("close");
+               log_perror("close");
                // Can continue (we have close-on-exec).
        }
 
        pthread_kill(worker_thread, SIGHUP);
        if (pthread_join(worker_thread, NULL) == -1) {
-               perror("pthread_join");
+               log_perror("pthread_join");
                exit(1);
        }
        
@@ -56,7 +57,7 @@ void Thread::stop()
        } while (err == -1 && errno == EINTR);
 
        if (err == -1) {
-               perror("close");
+               log_perror("close");
                // Can continue (we have close-on-exec).
        }
 }