aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-09 16:50:45 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2020-06-11 15:49:39 +0300
commitf8213c05f087e5fbb5d92a291f766b0baebc798f (patch)
tree37ef4f10f4c84aca2cec499bb1b268c493a2239b /src/sync.h
parent45a6811d36fc59ce0d7e2be7a848059a05b0486e (diff)
downloadbitcoin-f8213c05f087e5fbb5d92a291f766b0baebc798f.tar.xz
Add means to handle negative capabilities in thread safety annotations
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h
index 60e5a87aec..77327d8bfe 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -103,6 +103,12 @@ public:
}
using UniqueLock = std::unique_lock<PARENT>;
+#ifdef __clang__
+ //! For negative capabilities in the Clang Thread Safety Analysis.
+ //! A negative requirement uses the EXCLUSIVE_LOCKS_REQUIRED attribute, in conjunction
+ //! with the ! operator, to indicate that a mutex should not be held.
+ const AnnotatedMixin& operator!() const { return *this; }
+#endif // __clang__
};
/**