Revert "Backport SPSCQueue commit 3086fa9."

This reverts commit 2a3a57d245.

Fucking MSVC 2015 has chosen to emit errors on unsupported attributes.
This commit is contained in:
Bartosz Taudul 2022-04-01 16:46:50 +02:00
parent ffc06087b9
commit e83e83dae9
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -79,7 +79,7 @@ public:
writeIdx_.store(nextWriteIdx, std::memory_order_release); writeIdx_.store(nextWriteIdx, std::memory_order_release);
} }
[[nodiscard]] T *front() noexcept { T *front() noexcept {
auto const readIdx = readIdx_.load(std::memory_order_relaxed); auto const readIdx = readIdx_.load(std::memory_order_relaxed);
if (readIdx == writeIdxCache_) { if (readIdx == writeIdxCache_) {
writeIdxCache_ = writeIdx_.load(std::memory_order_acquire); writeIdxCache_ = writeIdx_.load(std::memory_order_acquire);
@ -103,7 +103,7 @@ public:
readIdx_.store(nextReadIdx, std::memory_order_release); readIdx_.store(nextReadIdx, std::memory_order_release);
} }
[[nodiscard]] size_t size() const noexcept { size_t size() const noexcept {
std::ptrdiff_t diff = writeIdx_.load(std::memory_order_acquire) - std::ptrdiff_t diff = writeIdx_.load(std::memory_order_acquire) -
readIdx_.load(std::memory_order_acquire); readIdx_.load(std::memory_order_acquire);
if (diff < 0) { if (diff < 0) {
@ -112,12 +112,12 @@ public:
return static_cast<size_t>(diff); return static_cast<size_t>(diff);
} }
[[nodiscard]] bool empty() const noexcept { bool empty() const noexcept {
return writeIdx_.load(std::memory_order_acquire) == return writeIdx_.load(std::memory_order_acquire) ==
readIdx_.load(std::memory_order_acquire); readIdx_.load(std::memory_order_acquire);
} }
[[nodiscard]] size_t capacity() const noexcept { return capacity_ - 1; } size_t capacity() const noexcept { return capacity_ - 1; }
private: private:
static constexpr size_t kCacheLineSize = 64; static constexpr size_t kCacheLineSize = 64;