Boost logo

Boost Users :

Subject: Re: [Boost-users] [lockfree] compile-time capacity vs. run-time capacity
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2013-02-21 05:23:01


2013/2/15 Akira Takahashi <faithandbrave_at_[hidden]>

> Hi,
> I confused with boost::lockfree::queue behavior.
>
> Fist, run-time capacity:
>
> #include <iostream>
> #include <boost/lockfree/queue.hpp>
>
> int main()
> {
> boost::lockfree::queue<int, boost::lockfree::fixed_sized<true>> 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; // true
> std::cout << que.push(4) << std::endl; // false
> }
>
> I think this behavior is correct.
>
> But, compile-time capacity:
>
> #include <iostream>
> #include <boost/lockfree/queue.hpp>
>
> int main()
> {
> boost::lockfree::queue<int, boost::lockfree::capacity<3>> que;
>
> 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 : why?
> std::cout << que.push(4) << std::endl; // false
> }
>
> Is this bug or specification?
>
>
> Thanks,
> Akira
>

Added ticket.
https://svn.boost.org/trac/boost/ticket/8135



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net