diff options
-rw-r--r-- | raul/Thread.hpp | 2 | ||||
-rw-r--r-- | src/Thread.cpp | 20 |
2 files changed, 3 insertions, 19 deletions
diff --git a/raul/Thread.hpp b/raul/Thread.hpp index 02a5e3a..6ac5aeb 100644 --- a/raul/Thread.hpp +++ b/raul/Thread.hpp @@ -56,7 +56,6 @@ public: protected: explicit Thread(const std::string& name=""); - Thread(pthread_t thread, const std::string& name=""); /** Thread function to execute. * @@ -74,7 +73,6 @@ private: ThreadImpl* _impl; std::string _name; bool _thread_exists; - bool _own_thread; protected: bool _exit_flag; diff --git a/src/Thread.cpp b/src/Thread.cpp index f5969d6..1f85ce0 100644 --- a/src/Thread.cpp +++ b/src/Thread.cpp @@ -37,22 +37,10 @@ Thread::Thread(const std::string& name) : _impl(new ThreadImpl()) , _name(name) , _thread_exists(false) - , _own_thread(true) , _exit_flag(false) { } -/** Must be called from thread */ -Thread::Thread(pthread_t thread, const std::string& name) - : _impl(new ThreadImpl()) - , _name(name) - , _thread_exists(true) - , _own_thread(false) - , _exit_flag(false) -{ - _impl->pthread = thread; -} - Thread::~Thread() { stop(); @@ -87,11 +75,9 @@ void Thread::stop() { if (_thread_exists) { - if (_own_thread) { - _exit_flag = true; - pthread_cancel(_impl->pthread); - pthread_join(_impl->pthread, NULL); - } + _exit_flag = true; + pthread_cancel(_impl->pthread); + pthread_join(_impl->pthread, NULL); _thread_exists = false; LOG(info) << "Exiting thread" << endl; } |