Comments (3)
There are 3 things you can do with the queue:
- Create.
- Push.
- Pop.
What exactly do you find hard?
from atomic_queue.
This sounds like a good idea although it's a million $ question :)
from atomic_queue.
There are 3 things you can do with the queue:
- Create.
- Push.
- Pop.
What exactly do you find hard?
Sorry for my poor c++ foundation, I should learn more about template in c++. I spent some time reading the benchmark code and know how to use atomic_queue gradually.
I mean maybe you can provide a simple demo to show how to use the atomic_queue specially. Now you show the usage in the benchmark file with other queue mixed.
As a beginner,I prefer moodycamel::ConcurrentQueue's doc as its simple use(header only) and simple usage doc. After reading the atomic_queque benchmark code, I don't konw how to use it directly😂, My C ++ foundation is too poor to understand your advanced code. You good at template programming.
Finally I still want to appreciate you provide such great code, I will continue to study learning to use it.
After reading the code, the way to use atomic_queue is just like this?(pseudocode)
// create OptimistAtomicQueue MPMC
AtomicQueue queue = AtomicQueue<T, SIZE, false, true, true>();
// push and pop
queue.push(T);
T = queue.pop();
@max0x7ba I had tested the code, thank your for your reply. you can close this issue.
int main()
{
using namespace ::atomic_queue;
constexpr unsigned CAPACITY = 1024;
AtomicQueue<unsigned, CAPACITY> queue;
queue.push(1);
queue.push(10);
unsigned num = queue.pop();
std::cout << "num:" << num << std::endl;
num = queue.pop();
std::cout << "num:" << num << std::endl;
return 0;
}
g++ -std=c++14 -O2 -Wall -pedantic -pthread main.cpp && ./a.out
result:
num:1
num:10
from atomic_queue.
Related Issues (20)
- 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
- why compare_exchange_strong() in a loop? HOT 5
- spin-locking HOT 1
- Create a `v1.6.2` release HOT 1
- Atomics are not trivial HOT 1
- push std::vector data package HOT 1
- Unbounded queue possible with atomic_queue? HOT 13
- Benchmark comments HOT 2
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.