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
| 824 | // includes making the memory effects of construction visible, possibly with a |
| 825 | // memory barrier). |
| 826 | explicit ConcurrentQueue(size_t capacity = 32 * BLOCK_SIZE) |
| 827 | : producerListTail(nullptr), |
| 828 | producerCount(0), |
| 829 | initialBlockPoolIndex(0), |
| 830 | nextExplicitConsumerId(0), |
| 831 | globalExplicitConsumerOffset(0) |
| 832 | { |
| 833 | implicitProducerHashResizeInProgress.clear(std::memory_order_relaxed); |
| 834 | populate_initial_implicit_producer_hash(); |
| 835 | populate_initial_block_list(capacity / BLOCK_SIZE + ((capacity & (BLOCK_SIZE - 1)) == 0 ? 0 : 1)); |
| 836 | |
| 837 | #ifdef MOODYCAMEL_QUEUE_INTERNAL_DEBUG |
| 838 | // Track all the producers using a fully-resolved typed list for |
| 839 | // each kind; this makes it possible to debug them starting from |
| 840 | // the root queue object (otherwise wacky casts are needed that |
| 841 | // don't compile in the debugger's expression evaluator). |
| 842 | explicitProducers.store(nullptr, std::memory_order_relaxed); |
| 843 | implicitProducers.store(nullptr, std::memory_order_relaxed); |
| 844 | #endif |
| 845 | } |
| 846 | |
| 847 | // Computes the correct amount of pre-allocated blocks for you based |
| 848 | // on the minimum number of elements you want available at any given |
nothing calls this directly
no test coverage detected