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 /contrib/epee/include/syncobj.h | |
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)
Diffstat (limited to 'contrib/epee/include/syncobj.h')
-rw-r--r-- | contrib/epee/include/syncobj.h | 17 |
1 files changed, 12 insertions, 5 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() } |