]> git.sesse.net Git - cubemap/blobdiff - main.cpp
Minor nit.
[cubemap] / main.cpp
index e270141e62941f6c33202d34f15786d62fca9200..69f0e9b7cb686b19293a4aef184e6b54941584b7 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -265,8 +265,8 @@ int main(int argc, char **argv)
 
        servers->run();
 
 
        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;
 
        // Find all streams in the configuration file, and create inputs for them.
        vector<Input *> inputs;
@@ -302,6 +302,9 @@ int main(int argc, char **argv)
                inputs.push_back(input);
        }
        
                inputs.push_back(input);
        }
        
+       // All deserialized inputs should now have been taken care of, one way or the other.
+       assert(deserialized_inputs.empty());
+       
        if (is_reexec) {        
                // Put back the existing clients. It doesn't matter which server we
                // allocate them to, so just do round-robin. However, we need to add
        if (is_reexec) {        
                // Put back the existing clients. It doesn't matter which server we
                // allocate them to, so just do round-robin. However, we need to add
@@ -311,9 +314,6 @@ int main(int argc, char **argv)
                }
        }
 
                }
        }
 
-       // All deserialized inputs should now have been taken care of, one way or the other.
-       assert(deserialized_inputs.empty());
-
        // Start writing statistics.
        if (stats_thread != NULL) {
                stats_thread->run();
        // Start writing statistics.
        if (stats_thread != NULL) {
                stats_thread->run();
@@ -342,11 +342,7 @@ int main(int argc, char **argv)
        if (stats_thread != NULL) {
                stats_thread->stop();
        }
        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);
 
        CubemapStateProto state;
        state.set_serialize_start_sec(serialize_start.tv_sec);