diff options
author | Bartosz Taudul <wolf@nereid.pl> | 2022-03-18 04:09:00 +0300 |
---|---|---|
committer | Bartosz Taudul <wolf@nereid.pl> | 2022-03-18 04:09:00 +0300 |
commit | 2a3a57d245cc3e0736076dadeefd16f60853582f (patch) | |
tree | dd7cce1e4c6b155fa5aaa3b8e6e17e353327001e | |
parent | c2fcc699be975809114b7909fbb098e31db3e934 (diff) |
Backport SPSCQueue commit 3086fa9.
-rw-r--r-- | client/tracy_SPSCQueue.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/client/tracy_SPSCQueue.h b/client/tracy_SPSCQueue.h index 7f1752b5..d683ed15 100644 --- a/client/tracy_SPSCQueue.h +++ b/client/tracy_SPSCQueue.h @@ -79,7 +79,7 @@ public: writeIdx_.store(nextWriteIdx, std::memory_order_release); } - T *front() noexcept { + [[nodiscard]] T *front() noexcept { auto const readIdx = readIdx_.load(std::memory_order_relaxed); if (readIdx == writeIdxCache_) { writeIdxCache_ = writeIdx_.load(std::memory_order_acquire); @@ -103,7 +103,7 @@ public: readIdx_.store(nextReadIdx, std::memory_order_release); } - size_t size() const noexcept { + [[nodiscard]] size_t size() const noexcept { std::ptrdiff_t diff = writeIdx_.load(std::memory_order_acquire) - readIdx_.load(std::memory_order_acquire); if (diff < 0) { @@ -112,12 +112,12 @@ public: return static_cast<size_t>(diff); } - bool empty() const noexcept { + [[nodiscard]] bool empty() const noexcept { return writeIdx_.load(std::memory_order_acquire) == readIdx_.load(std::memory_order_acquire); } - size_t capacity() const noexcept { return capacity_ - 1; } + [[nodiscard]] size_t capacity() const noexcept { return capacity_ - 1; } private: static constexpr size_t kCacheLineSize = 64; |