add mutex to get_randomx_code

master
moneroexamples 6 years ago
parent a8c3f4072a
commit 636179ac53

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

Loading…
Cancel
Save