]> git.sesse.net Git - cubemap/blobdiff - server.cpp
Factor all the common thread starting/stopping into a common Thread class.
[cubemap] / server.cpp
index aed8779a25a3807c02347f2c19063b581c016b63..d3fbaaff297867b5fe5e4323e04ffd8c4ce3ebb2 100644 (file)
@@ -177,31 +177,6 @@ Server::~Server()
        }
 }
 
-void Server::run()
-{
-       should_stop = false;
-       
-       // Joinable is already the default, but it's good to be certain.
-       pthread_attr_t attr;
-       pthread_attr_init(&attr);
-       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-       pthread_create(&worker_thread, &attr, Server::do_work_thunk, this);
-}
-       
-void Server::stop()
-{
-       {
-               MutexLock lock(&mutex);
-               should_stop = true;
-       }
-
-       pthread_kill(worker_thread, SIGHUP);
-       if (pthread_join(worker_thread, NULL) == -1) {
-               perror("pthread_join");
-               exit(1);
-       }
-}
-       
 vector<ClientStats> Server::get_client_stats() const
 {
        vector<ClientStats> ret;
@@ -215,13 +190,6 @@ vector<ClientStats> Server::get_client_stats() const
        return ret;
 }
 
-void *Server::do_work_thunk(void *arg)
-{
-       Server *server = static_cast<Server *>(arg);
-       server->do_work();
-       return NULL;
-}
-
 void Server::do_work()
 {
        for ( ;; ) {