diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/checkqueue.h | 6 | ||||
-rw-r--r-- | src/test/checkqueue_tests.cpp | 11 | ||||
-rw-r--r-- | src/test/fuzz/checkqueue.cpp | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/checkqueue.h b/src/checkqueue.h index d83f717fb7..63628860c5 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -11,6 +11,7 @@ #include <util/threadnames.h> #include <algorithm> +#include <iterator> #include <vector> template <typename T> @@ -173,10 +174,7 @@ public: { LOCK(m_mutex); - for (T& check : vChecks) { - queue.emplace_back(); - check.swap(queue.back()); - } + queue.insert(queue.end(), std::make_move_iterator(vChecks.begin()), std::make_move_iterator(vChecks.end())); nTodo += vChecks.size(); } diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp index 135f107159..90154c8757 100644 --- a/src/test/checkqueue_tests.cpp +++ b/src/test/checkqueue_tests.cpp @@ -140,6 +140,17 @@ struct FrozenCleanupCheck { cv.wait(l, []{ return nFrozen.load(std::memory_order_relaxed) == 0;}); } } + FrozenCleanupCheck(FrozenCleanupCheck&& other) noexcept + { + should_freeze = other.should_freeze; + other.should_freeze = false; + } + FrozenCleanupCheck& operator=(FrozenCleanupCheck&& other) noexcept + { + should_freeze = other.should_freeze; + other.should_freeze = false; + return *this; + } void swap(FrozenCleanupCheck& x) noexcept { std::swap(should_freeze, x.should_freeze); diff --git a/src/test/fuzz/checkqueue.cpp b/src/test/fuzz/checkqueue.cpp index 6256aefaa3..0c776e1b2f 100644 --- a/src/test/fuzz/checkqueue.cpp +++ b/src/test/fuzz/checkqueue.cpp @@ -13,7 +13,7 @@ namespace { struct DumbCheck { - const bool result = false; + bool result = false; DumbCheck() = default; |