aboutsummaryrefslogtreecommitdiff
path: root/src/threadsafety.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-07-31 15:30:21 -0400
committerRussell Yanofsky <russ@yanofsky.org>2018-11-06 11:44:40 -0400
commit081accb875412f38718f2e40ed7bbdf15e6f4ef8 (patch)
tree3984957eb798aa5ea1c07af07d54ed9f8c8723b3 /src/threadsafety.h
parent79d579f4e11b57f90fed314bccd25230f918729f (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.h11
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