So my question is does boost::lockfree::queue becomes a single-producer-single-consumer queue if set with the property fixed_size?
Answer: According to the docs, no. The member functions have different thread safety, but you can use the lockfree queue as a MRMW queue no matter if the policy is fixed_size<true>
or fixed_size<false>
(e.g. member functions push
and pop
are thread-safe).
See the comments to the OP for a discussion. Short version:
If I interpret the docs correctly, the fixed_size<true>
policy implies the following changes:
If you call
push
and no further capacity is available,push
fails and returnsfalse
.The maximum capacity that can be set is limited typically to 216-2 elements.
As the capacity is not changed automatically, you'll have to manually set the capacity via the ctor
queue(size_type)
or thereserve
member function. The default ctor will set the capacity to0
. (This implies that for the default capacity of0
, everypush
will fail.)