summaryrefslogtreecommitdiffstats
path: root/xmrstak/backend/cpu/minethd.cpp
diff options
context:
space:
mode:
authorpsychocrypt <psychocryptHPC@gmail.com>2018-05-01 20:46:02 +0200
committerpsychocrypt <psychocryptHPC@gmail.com>2018-05-12 22:29:09 +0200
commit95cc462d45dbcda08e32f43c53384b00028ad256 (patch)
tree239acdf7d7a53a9fa2a9d8ed7ba7488dec138966 /xmrstak/backend/cpu/minethd.cpp
parent94d41580e0b0400e93a2f0226eb71476b891f4a7 (diff)
downloadxmr-stak-95cc462d45dbcda08e32f43c53384b00028ad256.zip
xmr-stak-95cc462d45dbcda08e32f43c53384b00028ad256.tar.gz
fix job consume (possible deadlock)
fix #1505 - fix possible deadlock of the executor thread - fix racecondition during the job consumation - remove switch_work in all classes `minethd` - move `consume_work` into `globalStates`
Diffstat (limited to 'xmrstak/backend/cpu/minethd.cpp')
-rw-r--r--xmrstak/backend/cpu/minethd.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp
index 9a45785..8f79667 100644
--- a/xmrstak/backend/cpu/minethd.cpp
+++ b/xmrstak/backend/cpu/minethd.cpp
@@ -347,13 +347,6 @@ std::vector<iBackend*> minethd::thread_starter(uint32_t threadOffset, miner_work
return pvThreads;
}
-void minethd::consume_work()
-{
- memcpy(&oWork, &globalStates::inst().inst().oGlobalWork, sizeof(miner_work));
- iJobNo++;
- globalStates::inst().inst().iConsumeCnt++;
-}
-
minethd::cn_hash_fun minethd::func_selector(bool bHaveAes, bool bNoPrefetch, xmrstak_algo algo)
{
// We have two independent flag bits in the functions
@@ -450,7 +443,6 @@ void minethd::work_main()
piHashVal = (uint64_t*)(result.bResult + 24);
piNonce = (uint32_t*)(oWork.bWorkBlob + 39);
- globalStates::inst().inst().iConsumeCnt++;
result.iThreadId = iThreadNo;
uint8_t version = 0;
@@ -468,7 +460,7 @@ void minethd::work_main()
while (globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
- consume_work();
+ globalStates::inst().consume_work(oWork, iJobNo);
continue;
}
@@ -524,7 +516,7 @@ void minethd::work_main()
std::this_thread::yield();
}
- consume_work();
+ globalStates::inst().consume_work(oWork, iJobNo);
}
cryptonight_free_ctx(ctx);
@@ -773,7 +765,7 @@ void minethd::multiway_work_main()
while (globalStates::inst().iGlobalJobNo.load(std::memory_order_relaxed) == iJobNo)
std::this_thread::sleep_for(std::chrono::milliseconds(100));
- consume_work();
+ globalStates::inst().consume_work(oWork, iJobNo);
prep_multiway_work<N>(bWorkBlob, piNonce);
continue;
}
@@ -836,7 +828,7 @@ void minethd::multiway_work_main()
std::this_thread::yield();
}
- consume_work();
+ globalStates::inst().consume_work(oWork, iJobNo);
prep_multiway_work<N>(bWorkBlob, piNonce);
}
OpenPOWER on IntegriCloud