mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-16 14:16:16 +00:00
Ensure empty() is properly guarded
This commit is contained in:
+5
-2
@@ -20,10 +20,13 @@ public:
|
|||||||
using value_type = ThreadBase::thread_base_func;
|
using value_type = ThreadBase::thread_base_func;
|
||||||
using base_type = std::vector<value_type>;
|
using base_type = std::vector<value_type>;
|
||||||
|
|
||||||
using base_type::empty;
|
|
||||||
|
|
||||||
thread_queue_hack() { reserve(max_size); };
|
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) {
|
void push_back(value_type v) {
|
||||||
if (size() >= max_size)
|
if (size() >= max_size)
|
||||||
throw torrent::internal_error("Overflowed thread_queue max size of " + std::to_string(max_size) + ".");
|
throw torrent::internal_error("Overflowed thread_queue max size of " + std::to_string(max_size) + ".");
|
||||||
|
|||||||
Reference in New Issue
Block a user