diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-09-20 11:38:03 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2020-12-10 20:46:39 +0200 |
commit | cb23fe01c125e1820f3c37348e06d98c93e6aec2 (patch) | |
tree | c0552f04ef7d8af776d7b5947c03ece0db5707f1 /src/sync.h | |
parent | c5e3e74f70c29ac8852903ef425f5f327d5da969 (diff) |
[skip ci] sync: Check precondition in LEAVE_CRITICAL_SECTION() macro
This change reveals a bug in the wallet_tests/CreateWalletFromFile test,
that will be fixed in the following commit.
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sync.h b/src/sync.h index 0948083c7f..749bf5575c 100644 --- a/src/sync.h +++ b/src/sync.h @@ -242,10 +242,12 @@ using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove (cs).lock(); \ } -#define LEAVE_CRITICAL_SECTION(cs) \ - { \ - (cs).unlock(); \ - LeaveCritical(); \ +#define LEAVE_CRITICAL_SECTION(cs) \ + { \ + std::string lockname; \ + CheckLastCritical((void*)(&cs), lockname, #cs, __FILE__, __LINE__); \ + (cs).unlock(); \ + LeaveCritical(); \ } //! Run code while locking a mutex. |