| 27 | } |
| 28 | |
| 29 | const thread_pool::work* thread_pool::execute(std::function<void()>&& func) |
| 30 | { |
| 31 | thread_pool::work_ptr work = std::make_unique<thread_pool::work>(std::move(func)); |
| 32 | const thread_pool::work* result = work.get(); |
| 33 | const std::unique_lock lock(m_mutex); |
| 34 | ASSERT(m_running); |
| 35 | m_work.push_back(std::move(work)); |
| 36 | m_cv.notify_one(); |
| 37 | return result; |
| 38 | } |
| 39 | |
| 40 | bool thread_pool::try_pop(const work* w) |
| 41 | { |