X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fallocators.h;fp=src%2Fallocators.h;h=fc95452b4026f57015285831dd1d0c290bcace30;hp=bb72117b3378a7f94518a5916edbfeb9dffe39a2;hb=1dce23761237d85c2cfafd0757f1bef87b0087c4;hpb=82597c35e97568d9d53983211cdf29621cefdb51 diff --git a/src/allocators.h b/src/allocators.h index bb72117..fc95452 100644 --- a/src/allocators.h +++ b/src/allocators.h @@ -5,11 +5,13 @@ #ifndef BITCOIN_ALLOCATORS_H #define BITCOIN_ALLOCATORS_H -#include +#include // for OPENSSL_cleanse() + +#include #include -#include +#include +#include #include -#include // for OPENSSL_cleanse() #ifdef WIN32 #ifdef _WIN32_WINNT @@ -27,7 +29,7 @@ // the pagefile except in rare circumstances where memory is extremely low. #else #include -#include // for PAGESIZE +#include // for PAGESIZE #include // for sysconf #endif @@ -56,7 +58,7 @@ public: // For all pages in affected range, increase lock count void LockRange(void *p, size_t size) { - boost::mutex::scoped_lock lock(mutex); + std::scoped_lock lock(mutex); if(!size) return; const size_t base_addr = reinterpret_cast(p); const size_t start_page = base_addr & page_mask; @@ -79,7 +81,7 @@ public: // For all pages in affected range, decrease lock count void UnlockRange(void *p, size_t size) { - boost::mutex::scoped_lock lock(mutex); + std::scoped_lock lock(mutex); if(!size) return; const size_t base_addr = reinterpret_cast(p); const size_t start_page = base_addr & page_mask; @@ -102,13 +104,13 @@ public: // Get number of locked pages for diagnostics int GetLockedPageCount() { - boost::mutex::scoped_lock lock(mutex); + std::scoped_lock lock(mutex); return histogram.size(); } private: Locker locker; - boost::mutex mutex; + std::mutex mutex; size_t page_size, page_mask; // map of page base address to lock count typedef std::map Histogram;