add mutex to get_randomx_code

This commit is contained in:
moneroexamples 2019-05-28 07:57:48 +08:00
parent a8c3f4072a
commit 636179ac53
1 changed files with 4 additions and 0 deletions

View File

@ -7134,10 +7134,14 @@ get_randomx_code(uint64_t blk_height,
block const& blk,
crypto::hash const& blk_hash)
{
static std::mutex mtx;
vector<std::pair<string, string>> rx_code;
blobdata bd = get_block_hashing_blob(blk);
std::lock_guard<std::mutex> lk {mtx};
if (!rx_vm)
{
// this will create rx_vm instance if one