MCPcopy Create free account
hub / github.com/catboost/catboost / DequeueAll

Method DequeueAll

util/thread/lfqueue.h:323–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321 }
322 template <typename TCollection>
323 void DequeueAll(TCollection* res) {
324 AsyncRef();
325
326 TRootNode* newRoot = new TRootNode;
327 TRootNode* curRoot = JobQueue.load(std::memory_order_acquire);
328 do {
329 } while (!JobQueue.compare_exchange_weak(curRoot, newRoot));
330
331 FillCollection(curRoot->PopQueue, res);
332
333 TListNode* toDeleteHead = curRoot->PushQueue;
334 TListNode* toDeleteTail = FillCollectionReverse(curRoot->PushQueue, res);
335 curRoot->PushQueue.store(nullptr, std::memory_order_release);
336
337 if (toDeleteTail) {
338 toDeleteTail->Next.store(curRoot->PopQueue.load());
339 } else {
340 toDeleteTail = curRoot->PopQueue;
341 }
342 curRoot->PopQueue.store(nullptr, std::memory_order_release);
343
344 AsyncUnref(curRoot, toDeleteHead);
345 }
346 bool IsEmpty() {
347 AsyncRef();
348 TRootNode* curRoot = JobQueue.load(std::memory_order_acquire);

Callers 2

DequeueAllRunnerFunction · 0.45
Y_UNIT_TESTFunction · 0.45

Calls 2

loadMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected