在Dmitry Vyukov用C++编写的优秀的有界mpmc队列中,请参阅:http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
他添加了一些填充变量。我假设这是为了使它与缓存线对齐以提高性能。
我有几个问题要问。
__attribute__ ((aligned (64)))
。static size_t const cacheline_size = 64;typedef char cacheline_pad_t cacheline_size;cacheline_pad_t pad0_;cell_t* const buffer_;size_t const buffer_mask_;cacheline_pad_t pad1_;std::atomic enqueue_pos_;cacheline_pad_t pad2_;std::atomic dequeue_pos_;cacheline_pad_t;
这个概念在gcc的c代码下能行吗?
https://stackoverflow.com/questions/8469427
复制相似问题