diff --git a/base/base_tests/threads_test.cpp b/base/base_tests/threads_test.cpp index 6a70938b63..5f2af4bf29 100644 --- a/base/base_tests/threads_test.cpp +++ b/base/base_tests/threads_test.cpp @@ -61,7 +61,10 @@ UNIT_TEST(Simple_Threads) class SomeClass { + DISALLOW_COPY(SomeClass); + public: + SomeClass() {} void Increment(int * a, int b) { *a = *a + b; diff --git a/base/thread.cpp b/base/thread.cpp index 7ca97a895f..dc6a710b22 100644 --- a/base/thread.cpp +++ b/base/thread.cpp @@ -32,6 +32,10 @@ void RunRoutine(shared_ptr routine) ///////////////////////////////////////////////////////////////////// // Thread wrapper implementation +Thread::Thread() +{ +} + Thread::~Thread() { // @todo (ygorshenin@): in general, it's not a good practice to diff --git a/base/thread.hpp b/base/thread.hpp index 2ec7b8b835..ab4b598064 100644 --- a/base/thread.hpp +++ b/base/thread.hpp @@ -40,7 +40,10 @@ class Thread thread m_thread; shared_ptr m_routine; + DISALLOW_COPY(Thread); + public: + Thread(); ~Thread(); /// Run thread immediately. @@ -96,7 +99,7 @@ typedef thread::id ThreadID; ThreadID GetCurrentThreadID(); -/// A wrapper around a std thread which executes callable object in android envorinment +/// A wrapper around a std thread which executes callable object in thread which is attached to JVM /// Class has the same interface as std::thread class SimpleThread { @@ -120,9 +123,6 @@ public: return *this; } - SimpleThread(const SimpleThread &) = delete; - SimpleThread & operator= (const SimpleThread &) = delete; - void detach() { m_thread.detach(); } id get_id() const noexcept { return m_thread.get_id(); } void join() { m_thread.join(); } @@ -133,6 +133,8 @@ public: private: static void ThreadFunc(function fn); + DISALLOW_COPY(SimpleThread); + thread m_thread; }; } // namespace threads