Optimized RandomX initialization and switching.

This commit is contained in:
XMRig 2019-08-01 20:37:05 +07:00
parent ab0d3b8919
commit 84ff8af4bd
9 changed files with 156 additions and 157 deletions

View file

@ -82,7 +82,9 @@ xmrig::CpuWorker<N>::~CpuWorker()
template<size_t N>
void xmrig::CpuWorker<N>::allocateRandomX_VM()
{
while (!Rx::isReady(m_job.currentJob(), m_node)) {
RxDataset *dataset = Rx::dataset(m_job.currentJob(), m_node);
while (dataset == nullptr) {
std::this_thread::sleep_for(std::chrono::milliseconds(200));
if (Nonce::sequence(Nonce::CPU) == 0) {
@ -90,13 +92,6 @@ void xmrig::CpuWorker<N>::allocateRandomX_VM()
}
}
RxDataset *dataset = Rx::dataset(m_node);
assert(dataset != nullptr);
if (!dataset) {
return;
}
if (!m_vm) {
m_vm = new RxVm(dataset, m_memory->scratchpad(), !m_hwAES);
}