BoundedQueue::Size() Interface read error
Describe the bug A clear and concise description of what the bug is.
I used BoundedQueue in multithreading and found an exception reading Size() during testing;
The task queue I set is 500, But the size I read is unusually large: 18446744073709551614;
It should be caused by a negative number in unsigned number subtraction:
template <typename T> inline uint64_t BoundedQueue<T>::Size() { return tail_ - head_ - 1; }
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.