Globals don't like accessing thread-locals on Windows. Since globals are sufficiently small, just make the whole thing thread-local.

This commit is contained in:
clemahieu 2017-08-23 04:12:31 -05:00
commit 59db1e779c
2 changed files with 4 additions and 2 deletions

2
rai/secure.cpp Normal file → Executable file
View file

@ -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);

4
rai/utility.hpp Normal file → Executable file
View file

@ -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 <uint8_t>;
using bufferstream = boost::iostreams::stream_buffer <boost::iostreams::basic_array_source <uint8_t>>;