diff options
author | fireice-uk <fireice-uk@users.noreply.github.com> | 2017-10-23 19:14:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 19:14:20 +0100 |
commit | 7030f1b3ab2ff9670c5251919d00387095cf71f2 (patch) | |
tree | 40c19dd7735f372aa194f1399aed4a30d81a1c24 /xmrstak/backend/globalStates.cpp | |
parent | a7116b999efae0b303cd2474bbea3c918a4fe8b3 (diff) | |
parent | 14ceeaca2ea501d1c4ad9ba90655cc3204cd27c3 (diff) | |
download | xmr-stak-7030f1b3ab2ff9670c5251919d00387095cf71f2.zip xmr-stak-7030f1b3ab2ff9670c5251919d00387095cf71f2.tar.gz |
Merge pull request #45 from fireice-uk/topic-nonce-alloc
Implement pool-controlled nonce allocation
Diffstat (limited to 'xmrstak/backend/globalStates.cpp')
-rw-r--r-- | xmrstak/backend/globalStates.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmrstak/backend/globalStates.cpp b/xmrstak/backend/globalStates.cpp index 9104040..78823c5 100644 --- a/xmrstak/backend/globalStates.cpp +++ b/xmrstak/backend/globalStates.cpp @@ -34,7 +34,7 @@ namespace xmrstak { -void globalStates::switch_work(miner_work& pWork) +void globalStates::switch_work(miner_work& pWork, pool_data& dat) { // iConsumeCnt is a basic lock-like polling mechanism just in case we happen to push work // faster than threads can consume them. This should never happen in real life. @@ -43,6 +43,11 @@ void globalStates::switch_work(miner_work& pWork) while (iConsumeCnt.load(std::memory_order_seq_cst) < iThreadCount) std::this_thread::sleep_for(std::chrono::milliseconds(100)); + size_t xid = dat.pool_id; + dat.pool_id = pool_id; + pool_id = xid; + + dat.iSavedNonce = iGlobalNonce.exchange(dat.iSavedNonce, std::memory_order_seq_cst); oGlobalWork = pWork; iConsumeCnt.store(0, std::memory_order_seq_cst); iGlobalJobNo++; |