Giter Site home page Giter Site logo

spsc_queue's People

Contributors

mengrao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spsc_queue's Issues

Target Architecture (armv8 compatibility)?

Hi,

I am trying to figure out the portability / correctness of SPSCQueue.h on different architetures, especially armv8.

For this, I am mostly going by https://www.kernel.org/doc/Documentation/memory-barriers.txt
My understanding is that both pop / push obviously need to happen in correct order / atomic.

I am familiar with
__asm__ volatile("" ::: "memory")
to enforce a compiler level barrier and
__asm__ volatile ("mfence" ::: "memory")
to actually enforce a cpu barrier at runtime.

This should boil down to _mm_mfence (x86) or __mf (arm).

It's not clear to me how, e.g.
asm volatile("" : "=m"(data) : "m"(read_idx) :); // memory fence
enforce a barrier at runtime.

Is this the case because x86 has a more or less strict memory ordering, and the ops are atomic (are they?)? Or is a full memory fence simply not needed in this case.

Also: How portable is this to architectures with weak memory ordering, e.g. to armv8?
Would std::atomic_thread_fence be needed as replacement? I see you used that at the beginning before replacing it with the asm instructions.

Many thanks for your efforts! :-)

消费者感知消息问题

你好, 我测试了SPSCQueue.h的代码,发现前CNT条消息,收不到?要写满CNT条消息后,消费者才能读取到第1条消息

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.