diff options
author | Determinant <[email protected]> | 2019-10-13 18:56:33 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-10-13 18:56:33 -0400 |
commit | c230c6d92e8bff8a3f401b3b538d08962180d0c2 (patch) | |
tree | fa118dba9a4dd1869ab6c098557ba1ff8eb3b96c /include | |
parent | 8f76e5d8823b684d91e19f8efebe5579e00c8c48 (diff) |
drop the use of alignas
Diffstat (limited to 'include')
-rw-r--r-- | include/salticidae/queue.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/include/salticidae/queue.h b/include/salticidae/queue.h index 9fd11f1..899a082 100644 --- a/include/salticidae/queue.h +++ b/include/salticidae/queue.h @@ -9,6 +9,7 @@ namespace salticidae { static size_t const cacheline_size = 64; +using cacheline_pad = uint8_t[cacheline_size]; class FreeList { public: @@ -21,7 +22,7 @@ class FreeList { }; private: - alignas(cacheline_size) std::atomic<Node *> top; + std::atomic<Node *> top; public: FreeList(): top(nullptr) {} @@ -92,8 +93,9 @@ template<typename T> class MPMCQueue { protected: struct Block: public FreeList::Node { - alignas(cacheline_size) std::atomic<uint32_t> head; - alignas(cacheline_size) std::atomic<uint32_t> tail; + std::atomic<uint32_t> head; + cacheline_pad _pad0; + std::atomic<uint32_t> tail; T elem[MPMCQ_SIZE]; std::atomic<bool> avail[MPMCQ_SIZE]; std::atomic<Block *> next; @@ -101,8 +103,9 @@ class MPMCQueue { FreeList blks; - alignas(cacheline_size) std::atomic<Block *> head; - alignas(cacheline_size) std::atomic<Block *> tail; + std::atomic<Block *> head; + cacheline_pad _pad0; + std::atomic<Block *> tail; template<typename U> bool _enqueue(U &&e, bool unbounded = true) { |