diff --git a/lockfree/spsc/bipartite_buf_impl.hpp b/lockfree/spsc/bipartite_buf_impl.hpp index da9a5c4..28fbd20 100644 --- a/lockfree/spsc/bipartite_buf_impl.hpp +++ b/lockfree/spsc/bipartite_buf_impl.hpp @@ -60,7 +60,7 @@ T *BipartiteBuf::WriteAcquire(const size_t free_required) { const size_t r = _r.load(std::memory_order_acquire); const size_t free = CalcFree(w, r); - const size_t linear_space = size - r; + const size_t linear_space = size - w; const size_t linear_free = std::min(free, linear_space); /* Try to find enough linear space until the end of the buffer */