26 bool Put(
const T& msg);
62 auto start = mStart.load(std::memory_order_acquire);
63 auto end = mEnd.load(std::memory_order_relaxed);
65 assert((
end + mBufferSize - start) >= 0);
66 int len = (
end + mBufferSize - start) % mBufferSize;
70 if (len + 1 >= (
int)(mBufferSize))
76 mEnd.store((
end + 1) % mBufferSize, std::memory_order_release);
85 auto start = mStart.load(std::memory_order_relaxed);
86 auto end = mEnd.load(std::memory_order_acquire);
87 int len = (
end + mBufferSize - start) % mBufferSize;
93 mStart.store((start + 1) % mBufferSize, std::memory_order_release);
LockFreeQueue(size_t maxLen)
NonInterfering< std::atomic< size_t > > mEnd
NonInterfering< std::atomic< size_t > > mStart
const char * end(const char *str) noexcept
Workaround for std::make_shared not working on macOs with over-alignment.