| 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) { |
nothing calls this directly
no test coverage detected