aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-02-18 11:14:50 +0200
committerRiccardo Spagni <ric@spagni.net>2019-02-18 11:14:50 +0200
commit1a0fa56189351f7de8788929ddf452a35b8d96f8 (patch)
tree76e3981b16bbc70d87ec9fbc444d3959d436f823
parentMerge pull request #5151 (diff)
parentCMakeLists.txt: detect and use -pthread compiler flag (diff)
downloadmonero-1a0fa56189351f7de8788929ddf452a35b8d96f8.tar.xz
Merge pull request #5153
32ebc95d CMakeLists.txt: detect and use -pthread compiler flag (moneromooo-monero) be2d061b miner: fix build with boost 1.69 (moneromooo-monero) 1de62cb1 mlocker: fix access to global lock map after dtor on exit (moneromooo-monero) 5544bb83 mlocker: fix dtor ordering problem (moneromooo-monero)
-rw-r--r--CMakeLists.txt2
-rw-r--r--contrib/epee/src/mlocker.cpp8
-rw-r--r--src/cryptonote_basic/miner.cpp2
3 files changed, 7 insertions, 5 deletions
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
diff --git a/contrib/epee/src/mlocker.cpp b/contrib/epee/src/mlocker.cpp
index 2d6e64e7a..368167174 100644
--- a/contrib/epee/src/mlocker.cpp
+++ b/contrib/epee/src/mlocker.cpp
@@ -83,13 +83,13 @@ namespace epee
boost::mutex &mlocker::mutex()
{
- static boost::mutex vmutex;
- return vmutex;
+ static boost::mutex *vmutex = new boost::mutex();
+ return *vmutex;
}
std::map<size_t, unsigned int> &mlocker::map()
{
- static std::map<size_t, unsigned int> vmap;
- return vmap;
+ static std::map<size_t, unsigned int> *vmap = new std::map<size_t, unsigned int>();
+ return *vmap;
}
size_t mlocker::get_page_size()
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;
}
}