From 59db1e779c43dd12efca16cff3bdf51f92066eb9 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Wed, 23 Aug 2017 04:12:31 -0500 Subject: [PATCH] Globals don't like accessing thread-locals on Windows. Since globals are sufficiently small, just make the whole thing thread-local. --- rai/secure.cpp | 2 +- rai/utility.hpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 rai/secure.cpp mode change 100644 => 100755 rai/utility.hpp diff --git a/rai/secure.cpp b/rai/secure.cpp old mode 100644 new mode 100755 index f61c4ed5..516082a4 --- a/rai/secure.cpp +++ b/rai/secure.cpp @@ -100,7 +100,7 @@ std::string const & rai::rai_live_genesis (globals.rai_live_genesis); rai::account const & rai::genesis_account (globals.genesis_account); std::string const & rai::genesis_block (globals.genesis_block); rai::uint128_t const & rai::genesis_amount (globals.genesis_amount); -thread_local CryptoPP::AutoSeededRandomPool rai::random_pool; +thread_local CryptoPP::AutoSeededRandomPool & rai::random_pool (globals.random_pool); rai::block_hash const & rai::not_a_block (globals.not_a_block); rai::block_hash const & rai::not_an_account (globals.not_an_account); diff --git a/rai/utility.hpp b/rai/utility.hpp old mode 100644 new mode 100755 index c1eb9a64..b6e7cb3e --- a/rai/utility.hpp +++ b/rai/utility.hpp @@ -21,7 +21,9 @@ namespace rai { -extern thread_local CryptoPP::AutoSeededRandomPool random_pool; +// Random pool used by RaiBlocks. +// This must be thread_local as long as the AutoSeededRandomPool implementation requires it +extern thread_local CryptoPP::AutoSeededRandomPool & random_pool; // We operate on streams of uint8_t by convention using stream = std::basic_streambuf ; using bufferstream = boost::iostreams::stream_buffer >;