diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index c994241b..07c0a484 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -41,18 +41,6 @@ //#define DISABLE_DEADLOCK_GUARD -#define VALIDATE_MUTEX_IS_FREE(mutex_mame) \ - if (mutex_mame.try_lock()) \ - { \ - mutex_mame.unlock(); \ - return; \ - } \ - else \ - { \ - LOG_ERROR("MUTEX IS NOT FREE ON DESTRUCTOR: " << #mutex_mame); \ - } - - namespace epee { @@ -640,13 +628,27 @@ namespace epee #define DEADLOCK_LOCATION __FILE__ ":" DEADLOCK_STRINGIFY(__LINE__) -/* + /* + + We do DEADLOCK_LOCATION and DEADLOCK_FUNCTION_DEF as separate variables passed into deadlock_guard + because in GCC __PRETTY_FUNCTION__ is not a literal (like __FILE__ macro) but const variable, and + can't concatenate it with other macro like we did in DEADLOCK_LOCATION. + + */ + +#define VALIDATE_MUTEX_IS_FREE(mutex_mame) \ + if (mutex_mame.try_lock()) \ + { \ + mutex_mame.unlock(); \ + return; \ + } \ + else \ + { \ + auto state_str = epee::deadlock_guard_singleton::get_dlg_state(); \ + LOG_ERROR("MUTEX IS NOT FREE ON DESTRUCTOR: " << #mutex_mame << ", address:" << (void*)&mutex_mame << ENDL << "DEAD LOCK GUARD state:" << ENDL << state_str); \ + } - We do DEADLOCK_LOCATION and DEADLOCK_FUNCTION_DEF as separate variables passed into deadlock_guard - because in GCC __PRETTY_FUNCTION__ is not a literal (like __FILE__ macro) but const variable, and - can't concatenate it with other macro like we did in DEADLOCK_LOCATION. -*/ #define DLG_CRITICAL_REGION_LOCAL_VAR(lock, varname) epee::guarded_critical_region_t varname(lock, DEADLOCK_FUNCTION_DEF, DEADLOCK_LOCATION, #lock, epee::log_space::log_singletone::get_thread_log_prefix()) #define DLG_CRITICAL_REGION_BEGIN_VAR(lock, varname) { epee::guarded_critical_region_t varname(lock, DEADLOCK_FUNCTION_DEF, DEADLOCK_LOCATION, #lock, epee::log_space::log_singletone::get_thread_log_prefix())