From 34c24653f7dfcfc8f793fa2020bd70bcd7d9b5a7 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Sun, 17 Mar 2024 17:41:55 -0400 Subject: [PATCH] Eliminate boost::thread dependency. --- include/bitcoin/database/primitives/head.hpp | 4 ++-- test/memory/accessor.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/include/bitcoin/database/primitives/head.hpp b/include/bitcoin/database/primitives/head.hpp index cc9a44de..aacb8ac5 100644 --- a/include/bitcoin/database/primitives/head.hpp +++ b/include/bitcoin/database/primitives/head.hpp @@ -20,8 +20,8 @@ #define LIBBITCOIN_DATABASE_PRIMITIVES_HEAD_HPP #include +#include #include -#include #include #include @@ -96,7 +96,7 @@ class head storage& file_; const Link buckets_; - mutable boost::upgrade_mutex mutex_; + mutable std::shared_mutex mutex_; }; } // namespace database diff --git a/test/memory/accessor.cpp b/test/memory/accessor.cpp index 5f9618a4..f1c22d02 100644 --- a/test/memory/accessor.cpp +++ b/test/memory/accessor.cpp @@ -31,19 +31,10 @@ BOOST_AUTO_TEST_CASE(accessor__construct_shared_mutex__unassigned__nulls) BOOST_REQUIRE(is_null(instance.end())); } -BOOST_AUTO_TEST_CASE(accessor__construct_upgrade_mutex__unassigned__nulls) -{ - boost::upgrade_mutex mutex; - accessor instance(mutex); - BOOST_REQUIRE(is_null(instance.data())); - BOOST_REQUIRE(is_null(instance.begin())); - BOOST_REQUIRE(is_null(instance.end())); -} - BOOST_AUTO_TEST_CASE(accessor__destruct__shared_lock__released) { - boost::upgrade_mutex mutex; - auto access = std::make_shared>(mutex); + std::shared_mutex mutex; + auto access = std::make_shared>(mutex); BOOST_REQUIRE(!mutex.try_lock()); access.reset(); BOOST_REQUIRE(mutex.try_lock());