| 252 | } |
| 253 | |
| 254 | concurrencpp::details::thread timer_queue::ensure_worker_thread(std::unique_lock<std::mutex>& lock) { |
| 255 | assert(lock.owns_lock()); |
| 256 | if (!m_idle) { |
| 257 | return {}; |
| 258 | } |
| 259 | |
| 260 | auto old_worker = std::move(m_worker); |
| 261 | |
| 262 | m_worker = details::thread( |
| 263 | details::make_executor_worker_name(details::consts::k_timer_queue_name), |
| 264 | [this] { |
| 265 | work_loop(); |
| 266 | }, |
| 267 | m_thread_started_callback, |
| 268 | m_thread_terminated_callback); |
| 269 | |
| 270 | m_idle = false; |
| 271 | return old_worker; |
| 272 | } |
| 273 | |
| 274 | concurrencpp::lazy_result<void> timer_queue::make_delay_object_impl(std::chrono::milliseconds due_time, |
| 275 | std::shared_ptr<concurrencpp::timer_queue> self, |