MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / ~ConcurrentQueue

Method ~ConcurrentQueue

ngscuda/concurrentqueue.h:858–899  ·  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

856 // being deleted. It's up to the user to synchronize this.
857 // This method is not thread safe.
858 ~ConcurrentQueue()
859 {
860 // Destroy producers
861 auto ptr = producerListTail.load(std::memory_order_relaxed);
862 while (ptr != nullptr) {
863 auto next = ptr->next_prod();
864 if (ptr->token != nullptr) {
865 ptr->token->producer = nullptr;
866 }
867 destroy(ptr);
868 ptr = next;
869 }
870
871 // Destroy implicit producer hash tables
872 MOODYCAMEL_CONSTEXPR_IF (INITIAL_IMPLICIT_PRODUCER_HASH_SIZE != 0) {
873 auto hash = implicitProducerHash.load(std::memory_order_relaxed);
874 while (hash != nullptr) {
875 auto prev = hash->prev;
876 if (prev != nullptr) { // The last hash is part of this object and was not allocated dynamically
877 for (size_t i = 0; i != hash->capacity; ++i) {
878 hash->entries[i].~ImplicitProducerKVP();
879 }
880 hash->~ImplicitProducerHash();
881 (Traits::free)(hash);
882 }
883 hash = prev;
884 }
885 }
886
887 // Destroy global free list
888 auto block = freeList.head_unsafe();
889 while (block != nullptr) {
890 auto next = block->freeListNext.load(std::memory_order_relaxed);
891 if (block->dynamicallyAllocated) {
892 destroy(block);
893 }
894 block = next;
895 }
896
897 // Destroy initial free list
898 destroy_array(initialBlockPool, initialBlockPoolSize);
899 }
900
901 // Disable copying and copy assignment
902 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
loadMethod · 0.80
next_prodMethod · 0.80
head_unsafeMethod · 0.80

Tested by

no test coverage detected