MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / ConcurrentQueue

Method ConcurrentQueue

source/util/concurrentqueue.h:813–832  ·  view source on GitHub ↗

Creates a queue with at least `capacity` element slots; note that the actual number of elements that can be inserted without additional memory allocation depends on the number of producers and the block size (e.g. if the block size is equal to `capacity`, only a single block will be allocated up-front, which means only a single producer will be able to enqueue elements without an extra allocation

Source from the content-addressed store, hash-verified

811 // includes making the memory effects of construction visible, possibly with a
812 // memory barrier).
813 explicit ConcurrentQueue(size_t capacity = 32 * BLOCK_SIZE)
814 : producerListTail(nullptr),
815 producerCount(0),
816 initialBlockPoolIndex(0),
817 nextExplicitConsumerId(0),
818 globalExplicitConsumerOffset(0)
819 {
820 implicitProducerHashResizeInProgress.clear(std::memory_order_relaxed);
821 populate_initial_implicit_producer_hash();
822 populate_initial_block_list(capacity / BLOCK_SIZE + ((capacity & (BLOCK_SIZE - 1)) == 0 ? 0 : 1));
823
824#ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG
825 // Track all the producers using a fully-resolved typed list for
826 // each kind; this makes it possible to debug them starting from
827 // the root queue object (otherwise wacky casts are needed that
828 // don't compile in the debugger's expression evaluator).
829 explicitProducers.store(nullptr, std::memory_order_relaxed);
830 implicitProducers.store(nullptr, std::memory_order_relaxed);
831#endif
832 }
833
834 // Computes the correct amount of pre-allocated blocks for you based
835 // on the minimum number of elements you want available at any given

Callers

nothing calls this directly

Calls 7

reown_producersFunction · 0.85
clearMethod · 0.45
storeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected