Documentation states, that pop returns
true, if the pop operation is successful, false if queue was empty.
However, the following example asserts sometimes (MSVC 19.42, even in debug) during pop:
boost::lockfree::queue<int> queue{0u};
const auto work = [&]
{
while (true)
{
int x = 0;
BOOST_VERIFY(queue.push(x));
BOOST_VERIFY(queue.pop(x));
}
};
std::jthread t0{ work };
std::jthread t1{ work };
The issue doesn't seem to happen when there is a barrier between the push and pop calls, suggesting that parallel push and pop calls may result in pop returning false, even when the initial queue isn't empty.