MCPcopy Create free account
hub / github.com/bloomberg/quantum / doDequeue

Method doDequeue

quantum/impl/quantum_task_queue_impl.h:307–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307inline
308ITask::Ptr TaskQueue::doDequeue(std::atomic_bool&, TaskListIter iter)
309{
310 //========================= LOCKED SCOPE =========================
311 SpinLock::Guard lock(_runQueueLock);
312 if (iter == _runQueue.end())
313 {
314 return nullptr;
315 }
316 if (iter == _blockedIt)
317 {
318 // we don't really know what's the next blocked task in the queue, so reset it
319 _blockedIt = _runQueue.end();
320 }
321 ITask::Ptr task = *iter;
322
323 task->terminate();
324 if (_queueIt == iter)
325 {
326 _queueIt = _runQueue.erase(iter);
327 _isAdvanced = true;
328 }
329 else
330 {
331 _runQueue.erase(iter);
332 }
333 _stats.decNumElements();
334 return task;
335}
336
337inline
338size_t TaskQueue::size() const

Callers

nothing calls this directly

Calls 3

endMethod · 0.80
decNumElementsMethod · 0.80
terminateMethod · 0.45

Tested by

no test coverage detected