summaryrefslogtreecommitdiffstats
path: root/minethd.cpp
diff options
context:
space:
mode:
authorfireice-uk <fireice-uk@users.noreply.github.com>2017-07-27 17:00:15 +0100
committerfireice-uk <fireice-uk@users.noreply.github.com>2017-07-27 17:00:15 +0100
commitc2203be45654c048d5571cc019314bc702e353ff (patch)
tree2a57ff7fa9ed84853d775cfdd551ba73a752e213 /minethd.cpp
parent429e019ed45e601d71949c495869292472add99e (diff)
downloadxmr-stak-c2203be45654c048d5571cc019314bc702e353ff.zip
xmr-stak-c2203be45654c048d5571cc019314bc702e353ff.tar.gz
Race condition fix
Diffstat (limited to 'minethd.cpp')
-rw-r--r--minethd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/minethd.cpp b/minethd.cpp
index 5c7871d..fac9fb4 100644
--- a/minethd.cpp
+++ b/minethd.cpp
@@ -161,6 +161,7 @@ minethd::minethd(miner_work& pWork, size_t iNo, bool double_work, bool no_prefet
bNoPrefetch = no_prefetch;
this->affinity = affinity;
+ std::lock_guard<std::mutex> lock(work_thd_mtx);
if(double_work)
oWorkThd = std::thread(&minethd::double_work_main, this);
else
@@ -363,6 +364,9 @@ minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch)
void minethd::pin_thd_affinity()
{
+ //Lock is needed because we need to use oWorkThd
+ std::lock_guard<std::mutex> lock(work_thd_mtx);
+
// pin memory to NUMA node
bindMemoryToNUMANode(affinity);
OpenPOWER on IntegriCloud