Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/thread.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/base/thread.cpp b/base/thread.cpp
index a70462c3b2..f63d0ca068 100644
--- a/base/thread.cpp
+++ b/base/thread.cpp
@@ -34,7 +34,16 @@ void RunRoutine(IRoutine * routine)
// Thread wrapper implementation
Thread::Thread() : m_routine(0) {}
-Thread::~Thread() { Join(); }
+Thread::~Thread()
+{
+ // @todo (ygorshenin@): in general, it's not a good practice to
+ // implicitly detach thread since detached threads work in
+ // background, consume system resources and make it hard to reason
+ // about program. Thus, all places where Thread is instantiated
+ // should be fixed to explicitly detach thread.
+ if (m_thread.joinable())
+ m_thread.detach();
+}
bool Thread::Create(IRoutine * pRoutine)
{