diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-07-31 15:30:21 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2018-11-06 11:44:40 -0400 |
commit | 081accb875412f38718f2e40ed7bbdf15e6f4ef8 (patch) | |
tree | 3984957eb798aa5ea1c07af07d54ed9f8c8723b3 /src/threadsafety.h | |
parent | 79d579f4e11b57f90fed314bccd25230f918729f (diff) |
Pass chain locked variables where needed
This commit does not change behavior. All it does is pass new function
parameters.
It is easiest to review this change with:
git log -p -n1 -U0 --word-diff-regex=.
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 |