]> git.sesse.net Git - cubemap/blobdiff - input.cpp
Factor all the common thread starting/stopping into a common Thread class.
[cubemap] / input.cpp
index ccc4bc0134e47870ae5e44f7f5c9210d897260bd..a54e6fb2d398341302f8bbf13bcaa5f5f8239d4d 100644 (file)
--- a/input.cpp
+++ b/input.cpp
@@ -114,35 +114,6 @@ InputProto Input::serialize() const
        return serialized;
 }
 
-void Input::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, Input::do_work_thunk, this);
-}
-
-void Input::stop()
-{
-       should_stop = true;
-
-       pthread_kill(worker_thread, SIGHUP);
-       if (pthread_join(worker_thread, NULL) == -1) {
-               perror("pthread_join");
-               exit(1);
-       }
-}
-
-void *Input::do_work_thunk(void *arg)
-{
-       Input *input = static_cast<Input *>(arg);
-       input->do_work();
-       return NULL;
-}
-
 int Input::lookup_and_connect(const string &host, const string &port)
 {
        addrinfo *ai;