Fix possible race condition in hashrate counting code
Use single atomic operation to switch between data points.
This commit is contained in:
parent
d9b6f46a6a
commit
a4550f55ea
4 changed files with 35 additions and 21 deletions
|
@ -143,11 +143,11 @@ void xmrig::Workers<T>::tick(uint64_t)
|
|||
}
|
||||
|
||||
for (Thread<T> *handle : m_workers) {
|
||||
if (!handle->worker()) {
|
||||
continue;
|
||||
if (handle->worker()) {
|
||||
uint64_t hashCount, timeStamp;
|
||||
handle->worker()->getHashrateData(hashCount, timeStamp);
|
||||
d_ptr->hashrate->add(handle->id(), hashCount, timeStamp);
|
||||
}
|
||||
|
||||
d_ptr->hashrate->add(handle->id(), handle->worker()->hashCount(), handle->worker()->timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue