X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=server.cpp;h=d3fbaaff297867b5fe5e4323e04ffd8c4ce3ebb2;hp=aed8779a25a3807c02347f2c19063b581c016b63;hb=7fc0624f07b0451f8a8c997e18c29da10076aa38;hpb=462cb16514a2b691ae4d4b76125b42fda83df712 diff --git a/server.cpp b/server.cpp index aed8779..d3fbaaf 100644 --- a/server.cpp +++ b/server.cpp @@ -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 Server::get_client_stats() const { vector ret; @@ -215,13 +190,6 @@ vector Server::get_client_stats() const return ret; } -void *Server::do_work_thunk(void *arg) -{ - Server *server = static_cast(arg); - server->do_work(); - return NULL; -} - void Server::do_work() { for ( ;; ) {