From c230c6d92e8bff8a3f401b3b538d08962180d0c2 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 13 Oct 2019 18:56:33 -0400 Subject: drop the use of alignas --- include/salticidae/queue.h | 13 ++++++++----- 1 file 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 top; + std::atomic top; public: FreeList(): top(nullptr) {} @@ -92,8 +93,9 @@ template class MPMCQueue { protected: struct Block: public FreeList::Node { - alignas(cacheline_size) std::atomic head; - alignas(cacheline_size) std::atomic tail; + std::atomic head; + cacheline_pad _pad0; + std::atomic tail; T elem[MPMCQ_SIZE]; std::atomic avail[MPMCQ_SIZE]; std::atomic next; @@ -101,8 +103,9 @@ class MPMCQueue { FreeList blks; - alignas(cacheline_size) std::atomic head; - alignas(cacheline_size) std::atomic tail; + std::atomic head; + cacheline_pad _pad0; + std::atomic tail; template bool _enqueue(U &&e, bool unbounded = true) { -- cgit v1.2.3-70-g09d2