all
I'm trying to use the boost library's lock free queue data structure.
#include <boost/thread/thread.hpp>
#include <boost/lockfree/queue.hpp>
However, I found out that these data structure do not support methods to get the number of current entries that these are containing (http://www.boost.org/doc/libs/1_53_0/doc/html/boost/lockfree/queue.html).
What I want is something similar to std::queue::size (http://en.cppreference.com/w/cpp/container/queue/size).
Thanks a lot for your help in advance!
If you just want to track high/low water marks, have an atomic counter that you increment when you enqueue, and decrement when you dequeue.
You can periodically sample that counter to do any tuning/statistical analysis that you might need.
The queue itself doesn't supply this operation, because you only pay for what you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With