From 5544bb8359bf4c6be18e9623d97cb5357c9ddffb Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 2 Nov 2018 12:59:06 +0000 Subject: [PATCH 1/4] mlocker: fix dtor ordering problem leak the mutex instead, it's a one off --- contrib/epee/src/mlocker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp index 2d6e64e7a..4c48cbb58 100644 --- a/contrib/epee/src/mlocker.cpp +++ b/contrib/epee/src/mlocker.cpp @@ -83,8 +83,8 @@ namespace epee boost::mutex &mlocker::mutex() { - static boost::mutex vmutex; - return vmutex; + static boost::mutex *vmutex = new boost::mutex(); + return *vmutex; } std::map &mlocker::map() { From 1de62cb1369ecf5e6eb4cef5c7fc378879a3dfe1 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Thu, 22 Nov 2018 01:39:12 +0000 Subject: [PATCH 2/4] mlocker: fix access to global lock map after dtor on exit as the lock, it now leaks --- contrib/epee/src/mlocker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp index 4c48cbb58..368167174 100644 --- a/contrib/epee/src/mlocker.cpp +++ b/contrib/epee/src/mlocker.cpp @@ -88,8 +88,8 @@ namespace epee } std::map &mlocker::map() { - static std::map vmap; - return vmap; + static std::map *vmap = new std::map(); + return *vmap; } size_t mlocker::get_page_size() From be2d061b94f53abdc90ffadf7775404362cd4493 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Mon, 22 Oct 2018 22:17:15 +0000 Subject: [PATCH 3/4] miner: fix build with boost 1.69 --- src/cryptonote_basic/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index 2bd43de94..fb373c6aa 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -637,7 +637,7 @@ namespace cryptonote boost::tribool battery_powered(on_battery_power()); if(!indeterminate( battery_powered )) { - on_ac_power = !battery_powered; + on_ac_power = !(bool)battery_powered; } } From 32ebc95df7c4627c069843a06dcb893f6a9a0900 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 13 Oct 2018 18:11:09 +0000 Subject: [PATCH 4/4] CMakeLists.txt: detect and use -pthread compiler flag The cmake thread detection just ain't enough to always work --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d16b2ad..0a995539c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -428,6 +428,8 @@ if (UNIX AND NOT APPLE) # Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) + add_c_flag_if_supported(-pthread CMAKE_C_FLAGS) + add_cxx_flag_if_supported(-pthread CMAKE_CXX_FLAGS) endif() # Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http