1
1
// Copyright (c) 2012-2020 The Bitcoin Core developers
2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
- #include < boost/test/unit_test.hpp>
5
- #include < boost/thread/lock_types.hpp>
6
- #include < boost/thread/shared_mutex.hpp>
7
4
#include < cuckoocache.h>
8
- #include < deque>
9
5
#include < random.h>
10
6
#include < script/sigcache.h>
11
7
#include < test/util/setup_common.h>
8
+
9
+ #include < boost/test/unit_test.hpp>
10
+
11
+ #include < deque>
12
+ #include < mutex>
13
+ #include < shared_mutex>
12
14
#include < thread>
15
+ #include < vector>
13
16
14
17
/* * Test Suite for CuckooCache
15
18
*
@@ -201,11 +204,11 @@ static void test_cache_erase_parallel(size_t megabytes)
201
204
* "future proofed".
202
205
*/
203
206
std::vector<uint256> hashes_insert_copy = hashes;
204
- boost ::shared_mutex mtx;
207
+ std ::shared_mutex mtx;
205
208
206
209
{
207
210
/* * Grab lock to make sure we release inserts */
208
- boost ::unique_lock<boost ::shared_mutex> l (mtx);
211
+ std ::unique_lock<std ::shared_mutex> l (mtx);
209
212
/* * Insert the first half */
210
213
for (uint32_t i = 0 ; i < (n_insert / 2 ); ++i)
211
214
set.insert (hashes_insert_copy[i]);
@@ -219,7 +222,7 @@ static void test_cache_erase_parallel(size_t megabytes)
219
222
/* * Each thread is emplaced with x copy-by-value
220
223
*/
221
224
threads.emplace_back ([&, x] {
222
- boost ::shared_lock<boost ::shared_mutex> l (mtx);
225
+ std ::shared_lock<std ::shared_mutex> l (mtx);
223
226
size_t ntodo = (n_insert/4 )/3 ;
224
227
size_t start = ntodo*x;
225
228
size_t end = ntodo*(x+1 );
@@ -234,7 +237,7 @@ static void test_cache_erase_parallel(size_t megabytes)
234
237
for (std::thread& t : threads)
235
238
t.join ();
236
239
/* * Grab lock to make sure we observe erases */
237
- boost ::unique_lock<boost ::shared_mutex> l (mtx);
240
+ std ::unique_lock<std ::shared_mutex> l (mtx);
238
241
/* * Insert the second half */
239
242
for (uint32_t i = (n_insert / 2 ); i < n_insert; ++i)
240
243
set.insert (hashes_insert_copy[i]);
0 commit comments