MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ~ConcurrentQueue

Function ~ConcurrentQueue

Source/ThirdParty/concurrentqueue.h:666–707  ·  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. This method is not thread safe.

Source from the content-addressed store, hash-verified

664 // being deleted. It's up to the user to synchronize this.
665 // This method is not thread safe.
666 ~ConcurrentQueue()
667 {
668 // Destroy producers
669 auto ptr = producerListTail.load(std::memory_order_relaxed);
670 while (ptr != nullptr) {
671 auto next = ptr->next_prod();
672 if (ptr->token != nullptr) {
673 ptr->token->producer = nullptr;
674 }
675 destroy(ptr);
676 ptr = next;
677 }
678
679 // Destroy implicit producer hash tables
680 if (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE != 0) {
681 auto hash = implicitProducerHash.load(std::memory_order_relaxed);
682 while (hash != nullptr) {
683 auto prev = hash->prev;
684 if (prev != nullptr) { // The last hash is part of this object and was not allocated dynamically
685 for (size_t i = 0; i != hash->capacity; ++i) {
686 hash->entries[i].~ImplicitProducerKVP();
687 }
688 hash->~ImplicitProducerHash();
689 (Traits::free)(hash);
690 }
691 hash = prev;
692 }
693 }
694
695 // Destroy global free list
696 auto block = freeList.head_unsafe();
697 while (block != nullptr) {
698 auto next = block->freeListNext.load(std::memory_order_relaxed);
699 if (block->dynamicallyAllocated) {
700 destroy(block);
701 }
702 block = next;
703 }
704
705 // Destroy initial free list
706 destroy_array(initialBlockPool, initialBlockPoolSize);
707 }
708
709 // Disable copying and copy assignment
710 ConcurrentQueue(ConcurrentQueue const&) = delete;

Callers

nothing calls this directly

Calls 5

destroyFunction · 0.85
destroy_arrayFunction · 0.85
loadMethod · 0.45
next_prodMethod · 0.45
head_unsafeMethod · 0.45

Tested by

no test coverage detected