| 37 | Thread::Thread() {} |
| 38 | |
| 39 | Thread::~Thread() |
| 40 | { |
| 41 | // @todo (ygorshenin@): in general, it's not a good practice to |
| 42 | // implicitly detach thread since detached threads work in |
| 43 | // background, consume system resources and make it hard to reason |
| 44 | // about program. Thus, all places where Thread is instantiated |
| 45 | // should be fixed to explicitly detach thread. |
| 46 | if (m_thread.joinable()) |
| 47 | m_thread.detach(); |
| 48 | } |
| 49 | |
| 50 | bool Thread::Create(std::unique_ptr<IRoutine> && routine) |
| 51 | { |