| 78 | } |
| 79 | |
| 80 | void thread_executor::retire_worker(std::list<details::thread>::iterator it) { |
| 81 | std::unique_lock<std::mutex> lock(m_lock); |
| 82 | auto last_retired = std::move(m_last_retired); |
| 83 | m_last_retired.splice(m_last_retired.begin(), m_workers, it); |
| 84 | |
| 85 | lock.unlock(); |
| 86 | m_condition.notify_one(); |
| 87 | |
| 88 | if (last_retired.empty()) { |
| 89 | return; |
| 90 | } |
| 91 | |
| 92 | assert(last_retired.size() == 1); |
| 93 | last_retired.front().join(); |
| 94 | } |