MCPcopy Create free account
hub / github.com/apache/incubator-pegasus / loop

Method loop

src/runtime/task/task_worker.cpp:228–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void task_worker::loop()
229{
230 task_queue *q = queue();
231 int best_batch_size = pool_spec().dequeue_batch_size;
232
233 while (_is_running) {
234 int batch_size = best_batch_size;
235 task *task = q->dequeue(batch_size), *next;
236
237 q->decrease_count(batch_size);
238
239#ifndef NDEBUG
240 int count = 0;
241#endif
242 while (task != nullptr) {
243 next = task->next;
244 task->next = nullptr;
245 task->exec_internal();
246 task = next;
247#ifndef NDEBUG
248 count++;
249#endif
250 }
251
252#ifndef NDEBUG
253 CHECK_EQ_MSG(count, batch_size, "returned task count and batch size do not match");
254#endif
255
256 _processed_task_count += batch_size;
257 }
258}
259
260const threadpool_spec &task_worker::pool_spec() const { return pool()->spec(); }
261

Callers

nothing calls this directly

Calls 3

decrease_countMethod · 0.80
exec_internalMethod · 0.80
dequeueMethod · 0.45

Tested by

no test coverage detected