aboutsummaryrefslogtreecommitdiff
path: root/src/random.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2018-12-17 17:03:30 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2019-01-16 16:31:34 -0800
commitaae8b9bf0f4fd2b801ee72cf191588c8b3a67c3c (patch)
treeacf20ab38f866d16f4287a4220e3588c936d1c99 /src/random.cpp
parentd3f54d1c82b131d817b20cd9daa75f9d3c9475e1 (diff)
downloadbitcoin-aae8b9bf0f4fd2b801ee72cf191588c8b3a67c3c.tar.xz
Add thread safety annotations to RNG state
Diffstat (limited to 'src/random.cpp')
-rw-r--r--src/random.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/random.cpp b/src/random.cpp
index f31d14acf6..6b7962aa13 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -297,10 +297,11 @@ void GetRandBytes(unsigned char* buf, int num)
namespace {
struct RNGState {
Mutex m_mutex;
- unsigned char m_state[32] = {0};
- uint64_t m_counter = 0;
+ unsigned char m_state[32] GUARDED_BY(m_mutex) = {0};
+ uint64_t m_counter GUARDED_BY(m_mutex) = 0;
- explicit RNGState() {
+ RNGState()
+ {
InitHardwareRand();
}
};