]> git.sesse.net Git - cubemap/blobdiff - main.cpp
Wrap the acceptor into the same thread logic as everything else.
[cubemap] / main.cpp
index e270141e62941f6c33202d34f15786d62fca9200..79d98394eed49c56dc37b5a7812b039250f60233 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -265,8 +265,8 @@ int main(int argc, char **argv)
 
        servers->run();
 
-       pthread_t acceptor_thread;
-       pthread_create(&acceptor_thread, NULL, acceptor_thread_run, reinterpret_cast<void *>(server_sock));
+       AcceptorThread acceptor_thread(server_sock);
+       acceptor_thread.run();
 
        // Find all streams in the configuration file, and create inputs for them.
        vector<Input *> inputs;
@@ -342,11 +342,7 @@ int main(int argc, char **argv)
        if (stats_thread != NULL) {
                stats_thread->stop();
        }
-       pthread_kill(acceptor_thread, SIGHUP);
-       if (pthread_join(acceptor_thread, NULL) == -1) {
-               perror("pthread_join");
-               exit(1);
-       }
+       acceptor_thread.stop();
 
        CubemapStateProto state;
        state.set_serialize_start_sec(serialize_start.tv_sec);