aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_bitcoin.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-12-19 07:40:37 +1300
committerMarcoFalke <falke.marco@gmail.com>2018-12-19 07:40:53 +1300
commitd4197812d47d2452b081b36ac06a032765f9f5a7 (patch)
treebbcda96ddf56f7a67e1821bfeb198db850528dbf /src/test/test_bitcoin.h
parentf055389cb9572ed96c93722f451dfb37e7f1f9a2 (diff)
parentfa61202cae6979c754b11842c5ed8d90f1cdcc45 (diff)
Merge #14985: test: Remove thread_local from test_bitcoin
fa61202cae test: Add comment to g_insecure_rand_ctx (MarcoFalke) fa0d3c4407 test: Undo thread_local g_insecure_rand_ctx (MarcoFalke) Pull request description: `thread_local` seems to be highly controversial according to the discussion in #14953, so remove it again from the tests. Also remove boost::thread_group in the test that uses it, since I am touching it anyway. Tree-SHA512: 977c1f597e3cfbd0e97d0b037d998fdbc701f62e9a2f57e02dbe1727b63ae8ff478dbd9d3d6dc4ffdfa23f2058b331f04949d51f23a8f55b41ecb75f088f1cbe
Diffstat (limited to 'src/test/test_bitcoin.h')
-rw-r--r--src/test/test_bitcoin.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h
index 71c0379eac..31d90c0151 100644
--- a/src/test/test_bitcoin.h
+++ b/src/test/test_bitcoin.h
@@ -26,7 +26,14 @@ std::ostream& operator<<(typename std::enable_if<std::is_enum<T>::value, std::os
return stream << static_cast<typename std::underlying_type<T>::type>(e);
}
-thread_local extern FastRandomContext g_insecure_rand_ctx;
+/**
+ * This global and the helpers that use it are not thread-safe.
+ *
+ * If thread-safety is needed, the global could be made thread_local (given
+ * that thread_local is supported on all architectures we support) or a
+ * per-thread instance could be used in the multi-threaded test.
+ */
+extern FastRandomContext g_insecure_rand_ctx;
static inline void SeedInsecureRand(bool deterministic = false)
{