MCPcopy Create free account
hub / github.com/cameron314/readerwriterqueue / ~ReaderWriterQueue

Function ~ReaderWriterQueue

readerwriterqueue.h:204–228  ·  view source on GitHub ↗

Note: The queue should not be accessed concurrently while it's being deleted. It's up to the user to synchronize this.

Source from the content-addressed store, hash-verified

202 // Note: The queue should not be accessed concurrently while it's
203 // being deleted. It's up to the user to synchronize this.
204 AE_NO_TSAN ~ReaderWriterQueue()
205 {
206 // Make sure we get the latest version of all variables from other CPUs:
207 fence(memory_order_sync);
208
209 // Destroy any remaining objects in queue and free memory
210 Block* frontBlock_ = frontBlock;
211 Block* block = frontBlock_;
212 do {
213 Block* nextBlock = block->next;
214 size_t blockFront = block->front;
215 size_t blockTail = block->tail;
216
217 for (size_t i = blockFront; i != blockTail; i = (i + 1) & block->sizeMask) {
218 auto element = reinterpret_cast<T*>(block->data + i * sizeof(T));
219 element->~T();
220 (void)element;
221 }
222
223 auto rawBlock = block->rawThis;
224 block->~Block();
225 std::free(rawBlock);
226 block = nextBlock;
227 } while (block != frontBlock_);
228 }
229
230
231 // Enqueues a copy of element if there is room in the queue.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected