| 50 | } |
| 51 | |
| 52 | void BackgroundThread::Finish () |
| 53 | { |
| 54 | if (m_thread) { |
| 55 | Submit([this] () { m_clearing = true; }); |
| 56 | std::unique_lock<std::mutex> lck(m_mutx); |
| 57 | m_done_cond.wait(lck, [this] () -> bool { return m_func.empty(); }); |
| 58 | m_clearing = false; |
| 59 | lck.unlock(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | } |