28 #include <shared_mutex>
30 #include <boost/thread.hpp>
This is a simple but thread-safe counter.
int reset()
Reset the counter to 0.
int operator()() const
Get current count.
int operator++()
Increase count by 1 and return the new counter value.
int m_counter
The counter.
WCounter operator=(WCounter &)
No copy operator.
int operator--()
Decrease count by 1 and return the new counter value.
WCounter(WCounter &)
No copy construction.
std::shared_mutex m_counterMutex
A mutex to protect the counter from concurrent updates.