Giter Site home page Giter Site logo

Comments (3)

max0x7ba avatar max0x7ba commented on August 16, 2024 1

There are 3 things you can do with the queue:

  1. Create.
  2. Push.
  3. Pop.

What exactly do you find hard?

from atomic_queue.

dendisuhubdy avatar dendisuhubdy commented on August 16, 2024

This sounds like a good idea although it's a million $ question :)

from atomic_queue.

345161974 avatar 345161974 commented on August 16, 2024

There are 3 things you can do with the queue:

  1. Create.
  2. Push.
  3. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.