MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / ~ConcurrentQueue

Method ~ConcurrentQueue

concurrentqueue.h:871–912  ·  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

869 // being deleted. It's up to the user to synchronize this.
870 // This method is not thread safe.
871 ~ConcurrentQueue()
872 {
873 // Destroy producers
874 auto ptr = producerListTail.load(std::memory_order_relaxed);
875 while (ptr != nullptr) {
876 auto next = ptr->next_prod();
877 if (ptr->token != nullptr) {
878 ptr->token->producer = nullptr;
879 }
880 destroy(ptr);
881 ptr = next;
882 }
883
884 // Destroy implicit producer hash tables
885 MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE != 0) {
886 auto hash = implicitProducerHash.load(std::memory_order_relaxed);
887 while (hash != nullptr) {
888 auto prev = hash->prev;
889 if (prev != nullptr) { // The last hash is part of this object and was not allocated dynamically
890 for (size_t i = 0; i != hash->capacity; ++i) {
891 hash->entries[i].~ImplicitProducerKVP();
892 }
893 hash->~ImplicitProducerHash();
894 (Traits::free)(hash);
895 }
896 hash = prev;
897 }
898 }
899
900 // Destroy global free list
901 auto block = freeList.head_unsafe();
902 while (block != nullptr) {
903 auto next = block->freeListNext.load(std::memory_order_relaxed);
904 if (block->dynamicallyAllocated) {
905 destroy(block);
906 }
907 block = next;
908 }
909
910 // Destroy initial free list
911 destroy_array(initialBlockPool, initialBlockPoolSize);
912 }
913
914 // Disable copying and copy assignment
915 ConcurrentQueue(ConcurrentQueue const&) MOODYCAMEL_DELETE_FUNCTION;

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected