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

Method acquireWaiting

quantum/impl/quantum_task_queue_impl.h:582–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582inline
583void TaskQueue::acquireWaiting()
584{
585 //========================= LOCKED SCOPE =========================
586 SpinLock::Guard lock(_waitQueueLock);
587 bool isEmpty = _runQueue.empty();
588 if (_waitQueue.empty())
589 {
590 if (isEmpty)
591 {
592 signalEmptyCondition(true);
593 }
594 _queueIt = _runQueue.begin();
595 ++_queueRound;
596 return;
597 }
598 if (!isEmpty)
599 {
600 //rewind by one since we are at end()
601 --_queueIt;
602 }
603 {
604 //splice wait queue unto run queue.
605 _runQueue.splice(_runQueue.end(), _waitQueue);
606 }
607 if (!isEmpty)
608 {
609 //move to first element from spliced queue
610 ++_queueIt;
611 }
612 else
613 {
614 _queueIt = _runQueue.begin();
615 ++_queueRound;
616 }
617}
618
619}}
620

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected