diff options
Diffstat (limited to 'src/test/cuckoocache_tests.cpp')
-rw-r--r-- | src/test/cuckoocache_tests.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/cuckoocache_tests.cpp b/src/test/cuckoocache_tests.cpp index 75c7e47e64..35b66cfc53 100644 --- a/src/test/cuckoocache_tests.cpp +++ b/src/test/cuckoocache_tests.cpp @@ -1,15 +1,18 @@ // Copyright (c) 2012-2020 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include <boost/test/unit_test.hpp> -#include <boost/thread/lock_types.hpp> -#include <boost/thread/shared_mutex.hpp> #include <cuckoocache.h> -#include <deque> #include <random.h> #include <script/sigcache.h> #include <test/util/setup_common.h> + +#include <boost/test/unit_test.hpp> + +#include <deque> +#include <mutex> +#include <shared_mutex> #include <thread> +#include <vector> /** Test Suite for CuckooCache * @@ -201,11 +204,11 @@ static void test_cache_erase_parallel(size_t megabytes) * "future proofed". */ std::vector<uint256> hashes_insert_copy = hashes; - boost::shared_mutex mtx; + std::shared_mutex mtx; { /** Grab lock to make sure we release inserts */ - boost::unique_lock<boost::shared_mutex> l(mtx); + std::unique_lock<std::shared_mutex> l(mtx); /** Insert the first half */ for (uint32_t i = 0; i < (n_insert / 2); ++i) set.insert(hashes_insert_copy[i]); @@ -219,7 +222,7 @@ static void test_cache_erase_parallel(size_t megabytes) /** Each thread is emplaced with x copy-by-value */ threads.emplace_back([&, x] { - boost::shared_lock<boost::shared_mutex> l(mtx); + std::shared_lock<std::shared_mutex> l(mtx); size_t ntodo = (n_insert/4)/3; size_t start = ntodo*x; size_t end = ntodo*(x+1); @@ -234,7 +237,7 @@ static void test_cache_erase_parallel(size_t megabytes) for (std::thread& t : threads) t.join(); /** Grab lock to make sure we observe erases */ - boost::unique_lock<boost::shared_mutex> l(mtx); + std::unique_lock<std::shared_mutex> l(mtx); /** Insert the second half */ for (uint32_t i = (n_insert / 2); i < n_insert; ++i) set.insert(hashes_insert_copy[i]); |