diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-02-29 17:30:10 -0500 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-02-29 17:30:10 -0500 |
commit | c3c4e28061429bdb0e9102557c5c9a826620b4c5 (patch) | |
tree | 34d93ce3018862ca5add44a3dbb5b97f2f40b664 | |
parent | Merge pull request #686 (diff) | |
parent | move g_test_dbg_lock_sleep from a global to a function level static (diff) | |
download | monero-c3c4e28061429bdb0e9102557c5c9a826620b4c5.tar.xz |
Merge pull request #687
5e3557d move g_test_dbg_lock_sleep from a global to a function level static (moneromooo-monero)
-rw-r--r-- | contrib/epee/include/syncobj.h | 17 | ||||
-rw-r--r-- | src/blockchain_utilities/blockchain_converter.cpp | 2 | ||||
-rw-r--r-- | src/blockchain_utilities/blockchain_dump.cpp | 2 | ||||
-rw-r--r-- | src/blockchain_utilities/blockchain_export.cpp | 2 | ||||
-rw-r--r-- | src/blockchain_utilities/blockchain_import.cpp | 2 | ||||
-rw-r--r-- | src/blockchain_utilities/cn_deserialize.cpp | 2 | ||||
-rw-r--r-- | src/connectivity_tool/conn_tool.cpp | 2 | ||||
-rw-r--r-- | src/daemon/daemon.cpp | 2 | ||||
-rw-r--r-- | src/daemon/main.cpp | 2 | ||||
-rw-r--r-- | src/miner/simpleminer.cpp | 1 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 2 | ||||
-rw-r--r-- | tests/core_proxy/core_proxy.cpp | 2 | ||||
-rw-r--r-- | tests/core_tests/chaingen_main.cpp | 2 | ||||
-rw-r--r-- | tests/functional_tests/main.cpp | 2 | ||||
-rw-r--r-- | tests/net_load_tests/clt.cpp | 2 | ||||
-rw-r--r-- | tests/net_load_tests/srv.cpp | 2 | ||||
-rw-r--r-- | tests/performance_tests/main.cpp | 2 | ||||
-rw-r--r-- | tests/unit_tests/main.cpp | 2 |
18 files changed, 13 insertions, 37 deletions
diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index 275324436..0833b4114 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -39,7 +39,14 @@ namespace epee { - extern unsigned int g_test_dbg_lock_sleep; + namespace debug + { + inline unsigned int &g_test_dbg_lock_sleep() + { + static unsigned int value = 0; + return value; + } + } struct simple_event { @@ -217,10 +224,10 @@ namespace epee #define SHARED_CRITICAL_REGION_BEGIN(x) { shared_guard critical_region_var(x) #define EXCLUSIVE_CRITICAL_REGION_BEGIN(x) { exclusive_guard critical_region_var(x) -#define CRITICAL_REGION_LOCAL(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::g_test_dbg_lock_sleep));} epee::critical_region_t<decltype(x)> critical_region_var(x) -#define CRITICAL_REGION_BEGIN(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::g_test_dbg_lock_sleep)); epee::critical_region_t<decltype(x)> critical_region_var(x) -#define CRITICAL_REGION_LOCAL1(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::g_test_dbg_lock_sleep));} epee::critical_region_t<decltype(x)> critical_region_var1(x) -#define CRITICAL_REGION_BEGIN1(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::g_test_dbg_lock_sleep)); epee::critical_region_t<decltype(x)> critical_region_var1(x) +#define CRITICAL_REGION_LOCAL(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t<decltype(x)> critical_region_var(x) +#define CRITICAL_REGION_BEGIN(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t<decltype(x)> critical_region_var(x) +#define CRITICAL_REGION_LOCAL1(x) {std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep()));} epee::critical_region_t<decltype(x)> critical_region_var1(x) +#define CRITICAL_REGION_BEGIN1(x) { std::this_thread::sleep_for(std::chrono::milliseconds(epee::debug::g_test_dbg_lock_sleep())); epee::critical_region_t<decltype(x)> critical_region_var1(x) #define CRITICAL_REGION_END() } diff --git a/src/blockchain_utilities/blockchain_converter.cpp b/src/blockchain_utilities/blockchain_converter.cpp index 17b6d81bf..7c33ec399 100644 --- a/src/blockchain_utilities/blockchain_converter.cpp +++ b/src/blockchain_utilities/blockchain_converter.cpp @@ -45,8 +45,6 @@ #include <iostream> -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace { diff --git a/src/blockchain_utilities/blockchain_dump.cpp b/src/blockchain_utilities/blockchain_dump.cpp index 53dc22f8b..6fa5ce801 100644 --- a/src/blockchain_utilities/blockchain_dump.cpp +++ b/src/blockchain_utilities/blockchain_dump.cpp @@ -38,8 +38,6 @@ #include "common/command_line.h" #include "version.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace po = boost::program_options; using namespace epee; // log_space diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp index f5dea731a..d90175a77 100644 --- a/src/blockchain_utilities/blockchain_export.cpp +++ b/src/blockchain_utilities/blockchain_export.cpp @@ -31,8 +31,6 @@ #include "common/command_line.h" #include "version.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace po = boost::program_options; using namespace epee; // log_space diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index 67ad24031..1aaf2bddc 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -44,8 +44,6 @@ #include "fake_core.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace { // CONFIG diff --git a/src/blockchain_utilities/cn_deserialize.cpp b/src/blockchain_utilities/cn_deserialize.cpp index 6c6288aec..bf02dc150 100644 --- a/src/blockchain_utilities/cn_deserialize.cpp +++ b/src/blockchain_utilities/cn_deserialize.cpp @@ -32,8 +32,6 @@ #include "common/command_line.h" #include "version.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace po = boost::program_options; using namespace epee; // log_space diff --git a/src/connectivity_tool/conn_tool.cpp b/src/connectivity_tool/conn_tool.cpp index 9f00300ae..458d30cc3 100644 --- a/src/connectivity_tool/conn_tool.cpp +++ b/src/connectivity_tool/conn_tool.cpp @@ -49,8 +49,6 @@ namespace po = boost::program_options; using namespace cryptonote; using namespace nodetool; -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace { const command_line::arg_descriptor<std::string, true> arg_ip = {"ip", "set ip"}; diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index ed6a66722..e79823d08 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -46,8 +46,6 @@ using namespace epee; #include <functional> -unsigned int epee::g_test_dbg_lock_sleep = 0; - namespace daemonize { struct t_internals { diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 089d8fb69..0717fd89b 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -132,7 +132,7 @@ int main(int argc, char const * argv[]) return 0; } - epee::g_test_dbg_lock_sleep = command_line::get_arg(vm, command_line::arg_test_dbg_lock_sleep); + epee::debug::g_test_dbg_lock_sleep() = command_line::get_arg(vm, command_line::arg_test_dbg_lock_sleep); std::string db_type = command_line::get_arg(vm, command_line::arg_db_type); diff --git a/src/miner/simpleminer.cpp b/src/miner/simpleminer.cpp index e04ffbbcf..ba956d90b 100644 --- a/src/miner/simpleminer.cpp +++ b/src/miner/simpleminer.cpp @@ -41,7 +41,6 @@ using namespace epee; namespace po = boost::program_options; -unsigned int epee::g_test_dbg_lock_sleep = 0; int main(int argc, char** argv) { diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 55bddcddd..e320a6243 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -73,8 +73,6 @@ typedef cryptonote::simple_wallet sw; #define EXTENDED_LOGS_FILE "wallet_details.log" -unsigned int epee::g_test_dbg_lock_sleep = 0; - #define DEFAULT_MIX 4 namespace diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp index 14a12e139..256faeccb 100644 --- a/tests/core_proxy/core_proxy.cpp +++ b/tests/core_proxy/core_proxy.cpp @@ -62,8 +62,6 @@ using namespace crypto; BOOST_CLASS_VERSION(nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<tests::proxy_core> >, 1); -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char* argv[]) { diff --git a/tests/core_tests/chaingen_main.cpp b/tests/core_tests/chaingen_main.cpp index 40bce1e4e..9f8a57821 100644 --- a/tests/core_tests/chaingen_main.cpp +++ b/tests/core_tests/chaingen_main.cpp @@ -44,8 +44,6 @@ namespace const command_line::arg_descriptor<bool> arg_test_transactions = {"test_transactions", ""}; } -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char* argv[]) { TRY_ENTRY(); diff --git a/tests/functional_tests/main.cpp b/tests/functional_tests/main.cpp index 0233c50b5..58a2a5c90 100644 --- a/tests/functional_tests/main.cpp +++ b/tests/functional_tests/main.cpp @@ -55,8 +55,6 @@ namespace const command_line::arg_descriptor<size_t> arg_test_repeat_count = {"test_repeat_count", "", 1}; } -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char* argv[]) { TRY_ENTRY(); diff --git a/tests/net_load_tests/clt.cpp b/tests/net_load_tests/clt.cpp index e6b5c0414..56089a4da 100644 --- a/tests/net_load_tests/clt.cpp +++ b/tests/net_load_tests/clt.cpp @@ -628,8 +628,6 @@ TEST_F(net_load_test_clt, permament_open_and_close_and_connections_closed_by_ser ASSERT_EQ(RESERVED_CONN_CNT, m_tcp_server.get_config_object().get_connections_count()); } -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char** argv) { epee::debug::get_set_enable_assert(true, false); diff --git a/tests/net_load_tests/srv.cpp b/tests/net_load_tests/srv.cpp index 5a737e616..d8d3eae2e 100644 --- a/tests/net_load_tests/srv.cpp +++ b/tests/net_load_tests/srv.cpp @@ -213,8 +213,6 @@ namespace }; } -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char** argv) { //set up logging options diff --git a/tests/performance_tests/main.cpp b/tests/performance_tests/main.cpp index 2e390fabc..84a51aa96 100644 --- a/tests/performance_tests/main.cpp +++ b/tests/performance_tests/main.cpp @@ -42,8 +42,6 @@ #include "generate_key_image_helper.h" #include "is_out_to_acc.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char** argv) { set_process_affinity(1); diff --git a/tests/unit_tests/main.cpp b/tests/unit_tests/main.cpp index b96129a3a..faaf9475a 100644 --- a/tests/unit_tests/main.cpp +++ b/tests/unit_tests/main.cpp @@ -32,8 +32,6 @@ #include "include_base_utils.h" -unsigned int epee::g_test_dbg_lock_sleep = 0; - int main(int argc, char** argv) { epee::debug::get_set_enable_assert(true, false); |