MCPcopy Create free account
hub / github.com/David-Haim/concurrencpp / ensure_worker_thread

Method ensure_worker_thread

source/timers/timer_queue.cpp:254–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254concurrencpp::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
274concurrencpp::lazy_result<void> timer_queue::make_delay_object_impl(std::chrono::milliseconds due_time,
275 std::shared_ptr<concurrencpp::timer_queue> self,

Callers

nothing calls this directly

Calls 2

threadFunction · 0.85
owns_lockMethod · 0.80

Tested by

no test coverage detected