aboutsummaryrefslogtreecommitdiff
path: root/src/threadsafety.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-07-26 17:19:07 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-07-26 19:13:56 +0200
commitf58674a20a127f104409e11c5c11591533ddf360 (patch)
treeedbc0723c962bec6b990028973bbbee9438b4980 /src/threadsafety.h
parent415f2bff69985a9238d75f380db4c26dda47ca53 (diff)
parent1e3bcd251768baeb95e555d51d2dc787a6b2acee (diff)
downloadbitcoin-f58674a20a127f104409e11c5c11591533ddf360.tar.xz
Merge #13423: [net] Thread safety annotations in net_processing
1e3bcd251768baeb95e555d51d2dc787a6b2acee [net_processing] Add thread safety annotations (Jesse Cohen) f393a533bebc088985f94c725b9af881500ba998 Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis (Jesse Cohen) Pull request description: (note that this depends on #13417) This commit fully annotates all globals in net_processing with clang thread safety annotations. Subsequent commits will begin transitioning some of this data away from cs_main into locks that are local to net_processing. Static thread safety analysis should it easier to verify correctness of that process. Tree-SHA512: b47aa410cb9ada21072370176aea9a74c575643fa1ee8cf1d43c8e28675eef17f33e5242ac422f840e8178e132ecb58412034c6334b68f1b57c686df80d4e8e2
Diffstat (limited to 'src/threadsafety.h')
-rw-r--r--src/threadsafety.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/threadsafety.h b/src/threadsafety.h
index 61e63dbc7a..d847269dff 100644
--- a/src/threadsafety.h
+++ b/src/threadsafety.h
@@ -31,6 +31,7 @@
#define EXCLUSIVE_LOCKS_REQUIRED(...) __attribute__((exclusive_locks_required(__VA_ARGS__)))
#define SHARED_LOCKS_REQUIRED(...) __attribute__((shared_locks_required(__VA_ARGS__)))
#define NO_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis))
+#define ASSERT_EXCLUSIVE_LOCK(...) __attribute((assert_exclusive_lock(__VA_ARGS__)))
#else
#define LOCKABLE
#define SCOPED_LOCKABLE
@@ -50,6 +51,7 @@
#define EXCLUSIVE_LOCKS_REQUIRED(...)
#define SHARED_LOCKS_REQUIRED(...)
#define NO_THREAD_SAFETY_ANALYSIS
+#define ASSERT_EXCLUSIVE_LOCK(...)
#endif // __GNUC__
#endif // BITCOIN_THREADSAFETY_H