diff options
Diffstat (limited to 'src/randomx_pow.cpp')
| -rw-r--r-- | src/randomx_pow.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/randomx_pow.cpp b/src/randomx_pow.cpp index d617ba2..1d058d4 100644 --- a/src/randomx_pow.cpp +++ b/src/randomx_pow.cpp | |||
| @@ -19,6 +19,7 @@ static randomx_cache* g_cache = NULL; | |||
| 19 | static randomx_dataset* g_dataset = NULL; | 19 | static randomx_dataset* g_dataset = NULL; |
| 20 | static randomx_vm* g_vmVerify = NULL; | 20 | static randomx_vm* g_vmVerify = NULL; |
| 21 | static CCriticalSection g_csVerify; | 21 | static CCriticalSection g_csVerify; |
| 22 | static std::mutex g_csInit; | ||
| 22 | static bool g_fInit = false; | 23 | static bool g_fInit = false; |
| 23 | static bool g_fFast = false; | 24 | static bool g_fFast = false; |
| 24 | 25 | ||
| @@ -28,6 +29,10 @@ bool RandomXInit() | |||
| 28 | if (g_fInit) | 29 | if (g_fInit) |
| 29 | return true; | 30 | return true; |
| 30 | 31 | ||
| 32 | std::lock_guard<std::mutex> lock(g_csInit); | ||
| 33 | if (g_fInit) | ||
| 34 | return true; | ||
| 35 | |||
| 31 | // Detect the best flags for this CPU (JIT, hardware AES, Argon2). | 36 | // Detect the best flags for this CPU (JIT, hardware AES, Argon2). |
| 32 | g_flags = randomx_get_flags(); | 37 | g_flags = randomx_get_flags(); |
| 33 | 38 | ||