Ensure empty() is properly guarded

This commit is contained in:
kannibalox
2024-12-02 09:27:12 -05:00
committed by Jari Sundell
parent 577818bde4
commit 58b1fc4914
+5 -2
View File
@@ -20,10 +20,13 @@ public:
using value_type = ThreadBase::thread_base_func;
using base_type = std::vector<value_type>;
using base_type::empty;
thread_queue_hack() { reserve(max_size); };
bool empty() {
std::lock_guard<std::mutex> lguard(m_lock);
return base_type::empty();
}
void push_back(value_type v) {
if (size() >= max_size)
throw torrent::internal_error("Overflowed thread_queue max size of " + std::to_string(max_size) + ".");