Comments (8)
The size of the queue gets round up to the next power of two with an extra constraint, see https://github.com/max0x7ba/atomic_queue/blob/master/include/atomic_queue/atomic_queue.h#L537
q.capacity()
reports the actual capacity.
from atomic_queue.
So shouldn't it stop printing at 16 then ?
from atomic_queue.
... round up to the next power of two with an extra constraint.
from atomic_queue.
Oh sorry, capacity is 4096. That's quite a way off from desired size 10. Is there a reason to do this? Can't it just be set to what the user wants?
from atomic_queue.
I would suggest that user to consider AtomicQueue2
and always read the documentation first.
from atomic_queue.
What if the size isn't known at compile time ?
from atomic_queue.
The queue is designed for ultra-low-latency and important optimizations require using power-of-2 and also certain minimum capacity. These optimizations can be disabled for queue variants that don't use heap allocation but require capacity to be a compile time constant.
If the capacity isn't known at compile time then I would suggest the user to accept the minimum capacity imposed by AtomicQueueB2
implementation.
from atomic_queue.
Cheers thank you. The other problem for me is the way the queue spins when try_push fails. My apps sometimes have to wait for data. And spinning hogs all the CPU on the calling thread. So maybe a mutex/condvar based queue is best for me. Thanks for the comments though. I should have read the docs more carefully first.
from atomic_queue.
Related Issues (20)
- Where is OptimistAtomicQueue? HOT 2
- mention vcpkg package HOT 4
- Make benchmark dependencies optional in meson.build? HOT 2
- Question: busy waiting? HOT 8
- Implementations for ppc64le and s390x? HOT 21
- about tag release HOT 1
- Could you add more apis such as Front() and PushFront()? HOT 1
- moodycamel::ConcurrentQueue performs better if using enqueue instead of try_enqueue HOT 2
- Low latency programming? HOT 1
- CPU load at 100% HOT 2
- Elaborate in docs what "atomic elements" means. HOT 4
- Ever incresing queue size HOT 2
- Construct allocator-aware queues with allocator HOT 2
- Please document the meaning of the NIL template parameter clearly HOT 3
- how to put struct to queue HOT 1
- Create a queue with object ptrs as queue elements. HOT 1
- 'optimist atomic queue' description is something different in read.md HOT 3
- Question: memory order in fetch_add() HOT 11
- build failure with gcc-13 HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atomic_queue.