-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
As far as I understood, the constructor:
ConcurrentQueue(size_t minCapacity, size_t maxExplicitProducers, size_t maxImplicitProducers)
uses the maxExplicitProducers and maxImplicitProducers to set the initial number of blocks. However, it does not preallocate producers (via add_producer). This means that try_enqueue can still malloc a producer when it is called.
Could the constructor mentioned above also include the following snippet in its body to minimise the chance of malloc when using try_enqueue?
for(size_t i = 0; i != maxImplicitProducers; ++i) {
auto* p = add_producer(create<ImplicitProducer>(this));
p->inactive.store(true, std::memory_order_relaxed);
}
Metadata
Metadata
Assignees
Labels
No labels