From 93b3a34f288ee1357e650a6b9e9c70929391c0e5 Mon Sep 17 00:00:00 2001 From: kannibalox Date: Mon, 2 Dec 2024 17:06:57 -0500 Subject: [PATCH] Properly lock size check, and remove overall cacheline alignment --- src/thread_base.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/thread_base.cc b/src/thread_base.cc index c74fb3a8..1e6b9c57 100644 --- a/src/thread_base.cc +++ b/src/thread_base.cc @@ -13,7 +13,7 @@ #include "globals.h" -class lt_cacheline_aligned thread_queue_hack : private std::vector { +class thread_queue_hack : private std::vector { public: static constexpr unsigned int max_size = 32; @@ -28,16 +28,16 @@ public: } 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) + "."); const std::lock_guard lguard(m_lock); + if (base_type::size() >= max_size) + throw torrent::internal_error("Overflowed thread_queue max size of " + std::to_string(max_size) + "."); base_type::push_back(v); } void copy_and_clear(base_type& target) { std::lock_guard lguard(m_lock); target.assign(begin(), end()); - clear(); + base_type::clear(); } private: