mirror of
https://github.com/monero-project/monero.git
synced 2025-08-09 07:52:18 -04:00
move g_test_dbg_lock_sleep from a global to a function level static
This avoids the need to define that variable in every program which uses epee.
This commit is contained in:
parent
3860feecb8
commit
5e3557d2c3
18 changed files with 13 additions and 37 deletions
|
@ -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() }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue