Wake a standby thread, and hand the given task over to this thread. */
| 736 | |
| 737 | /** Wake a standby thread, and hand the given task over to this thread. */ |
| 738 | bool thread_pool_generic::wake(worker_wake_reason reason, task *) |
| 739 | { |
| 740 | assert(reason != WAKE_REASON_NONE); |
| 741 | |
| 742 | if (m_standby_threads.empty()) |
| 743 | return false; |
| 744 | auto var= m_standby_threads.back(); |
| 745 | m_standby_threads.pop_back(); |
| 746 | m_active_threads.push_back(var); |
| 747 | assert(var->m_wake_reason == WAKE_REASON_NONE); |
| 748 | var->m_wake_reason= reason; |
| 749 | var->m_cv.notify_one(); |
| 750 | m_wakeups++; |
| 751 | return true; |
| 752 | } |
| 753 | |
| 754 | |
| 755 | thread_pool_generic::thread_pool_generic(int min_threads, int max_threads) : |
nothing calls this directly
no test coverage detected