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

Method EnqueueImpl

util/thread/lfqueue.h:172–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170 };
171
172 void EnqueueImpl(TListNode* head, TListNode* tail) {
173 TRootNode* newRoot = new TRootNode;
174 AsyncRef();
175 newRoot->PushQueue.store(head, std::memory_order_release);
176 for (TRootNode* curRoot = JobQueue.load(std::memory_order_acquire);;) {
177 tail->Next.store(curRoot->PushQueue.load(std::memory_order_acquire), std::memory_order_release);
178 newRoot->PopQueue.store(curRoot->PopQueue.load(std::memory_order_acquire), std::memory_order_release);
179 newRoot->CopyCounter(curRoot);
180
181 for (TListNode* node = head;; node = node->Next.load(std::memory_order_acquire)) {
182 newRoot->IncCount(node->Data);
183 if (node == tail) {
184 break;
185 }
186 }
187
188 if (JobQueue.compare_exchange_weak(curRoot, newRoot)) {
189 AsyncUnref(curRoot, nullptr);
190 break;
191 }
192 }
193 }
194
195 template <typename TCollection>
196 static void FillCollection(TListNode* lst, TCollection* res) {

Callers

nothing calls this directly

Calls 4

CopyCounterMethod · 0.80
storeMethod · 0.45
loadMethod · 0.45
IncCountMethod · 0.45

Tested by

no test coverage detected