diff options
Diffstat (limited to 'src/threadsafety.h')
-rw-r--r-- | src/threadsafety.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/threadsafety.h b/src/threadsafety.h index 47e6b2ea38..33acddc65c 100644 --- a/src/threadsafety.h +++ b/src/threadsafety.h @@ -54,4 +54,15 @@ #define ASSERT_EXCLUSIVE_LOCK(...) #endif // __GNUC__ +// Utility class for indicating to compiler thread analysis that a mutex is +// locked (when it couldn't be determined otherwise). +struct SCOPED_LOCKABLE LockAnnotation +{ + template <typename Mutex> + explicit LockAnnotation(Mutex& mutex) EXCLUSIVE_LOCK_FUNCTION(mutex) + { + } + ~LockAnnotation() UNLOCK_FUNCTION() {} +}; + #endif // BITCOIN_THREADSAFETY_H |