| 29 | std::atomic<size_t> DequeueCount = 0; |
| 30 | |
| 31 | void TryToFreeMemory() { |
| 32 | TNode* current = FreePtr.load(std::memory_order_acquire); |
| 33 | if (!current) { |
| 34 | return; |
| 35 | } |
| 36 | if (DequeueCount.load() == 1) { |
| 37 | // node current is in free list, we are the last thread so try to cleanup |
| 38 | if (FreePtr.compare_exchange_strong(current, nullptr)) { |
| 39 | EraseList(current); |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | void EraseList(TNode* p) { |
| 44 | while (p) { |
| 45 | TNode* next = p->Next; |
nothing calls this directly
no test coverage detected