diff options
Diffstat (limited to 'src/sync.h')
-rw-r--r-- | src/sync.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h index 2667fb52f9..bdbdde1a2a 100644 --- a/src/sync.h +++ b/src/sync.h @@ -304,4 +304,18 @@ public: } }; +// Utility class for indicating to compiler thread analysis that a mutex is +// locked (when it couldn't be determined otherwise). +struct SCOPED_LOCKABLE LockAssertion +{ + template <typename Mutex> + explicit LockAssertion(Mutex& mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) + { +#ifdef DEBUG_LOCKORDER + AssertLockHeld(mutex); +#endif + } + ~LockAssertion() UNLOCK_FUNCTION() {} +}; + #endif // BITCOIN_SYNC_H |