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

Method doEnqueue

quantum/impl/quantum_task_queue_impl.h:265–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265inline
266void TaskQueue::doEnqueue(ITask::Ptr task)
267{
268 //NOTE: _queueIt remains unchanged following this operation
269 _stats.incPostedCount();
270 _stats.incNumElements();
271 bool isEmpty = _waitQueue.empty();
272 if (task->isHighPriority())
273 {
274 //insert before the current position. If _queueIt == begin(), then the new
275 //task will be at the head of the queue.
276 _waitQueue.emplace_front(std::static_pointer_cast<Task>(task));
277 }
278 else
279 {
280 //insert after the current position. If next(_queueIt) == end()
281 //then the new task will be the last element in the queue
282 _waitQueue.emplace_back(std::static_pointer_cast<Task>(task));
283 }
284 if (task->isHighPriority())
285 {
286 _stats.incHighPriorityCount();
287 }
288 if (isEmpty)
289 {
290 //signal on transition from 0 to 1 element only
291 signalEmptyCondition(false);
292 }
293}
294
295inline
296ITask::Ptr TaskQueue::dequeue(std::atomic_bool& hint)

Callers

nothing calls this directly

Calls 5

incPostedCountMethod · 0.80
incNumElementsMethod · 0.80
incHighPriorityCountMethod · 0.80
emptyMethod · 0.45
isHighPriorityMethod · 0.45

Tested by

no test coverage detected