Opened 9 years ago

Closed 9 years ago

#8560 closed Bugs (fixed)

[lockfree] spsc_queue capacity one off

Reported by: reakinator@… Owned by: timblechmann
Milestone: To Be Determined Component: lockfree
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

This is related to ticket #8135

Should boost::lockfree::spsc_queue also be allocating one extra node to account for it's internal marker? Please consider the following simple example:

#include <iostream>
#include <boost/lockfree/spsc_queue.hpp>

int main()
{

    boost::lockfree::spsc_queue<float> que( 3 );
	
    std::cout << std::boolalpha;

    std::cout << que.push(1) << std::endl; // true
    std::cout << que.push(2) << std::endl; // true
    std::cout << que.push(3) << std::endl; // false <--- should be true?
    std::cout << que.push(4) << std::endl; // false

    return 0
}

Change History (1)

comment:1 by timblechmann, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.