Can boost::lockfree::queue's pop return false for non-empty queue?
- Dominant language
- C++
- Stars
- 160
- Forks
- 99
- PR merge metrics
- No merged PRs in 30d
Description
[Documentation](https://www.boost.org/doc/libs/1_85_0/doc/html/boost/lockfree/queue.html) 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`:
```cpp
boost::lockfree::queue 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.