MCPcopy Create free account
hub / github.com/MariaDB/server / execute

Method execute

tpool/task_group.cc:57–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 m_max_concurrent_tasks = max_concurrency;
56 }
57 void task_group::execute(task* t)
58 {
59 std::unique_lock<std::mutex> lk(m_mtx);
60 if (m_tasks_running == m_max_concurrent_tasks)
61 {
62 /* Queue for later execution by another thread.*/
63 m_queue.push(t);
64 m_total_enqueues++;
65 return;
66 }
67 m_tasks_running++;
68 for (;;)
69 {
70 lk.unlock();
71 if (t)
72 {
73 t->m_func(t->m_arg);
74 if (m_enable_task_release)
75 t->release();
76 }
77 lk.lock();
78 m_total_tasks++;
79 if (m_queue.empty())
80 break;
81 t = m_queue.front();
82 m_queue.pop();
83 }
84 m_tasks_running--;
85 }
86
87 void task_group::cancel_pending(task* t)
88 {

Callers

nothing calls this directly

Calls 7

pushMethod · 0.45
unlockMethod · 0.45
releaseMethod · 0.45
lockMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected