From 4d0edde66db0e88034ddf6a3152a870543132552 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 7 Apr 2020 18:48:02 +0200 Subject: [PATCH] Fixed pool lock --- src/crypto/randomx/randomx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index ae960df03..f5b4e682d 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -406,6 +406,8 @@ extern "C" { randomx_vm* vm = nullptr; + std::lock_guard lock(vm_pool_mutex); + static uint8_t* vm_pool[64] = {}; static size_t vm_pool_offset[64] = {}; @@ -415,8 +417,6 @@ extern "C" { node = 0; } - std::lock_guard lock(vm_pool_mutex); - if (!vm_pool[node]) { vm_pool[node] = (uint8_t*) xmrig::VirtualMemory::allocateLargePagesMemory(VM_POOL_SIZE); if (!vm_pool[node]) {