prevent manual mutex lock/unlock

This commit is contained in:
4ertus2 2024-10-20 23:19:09 +03:00
parent e32731b60b
commit ead82cdba9
4 changed files with 32 additions and 26 deletions

View file

@ -556,7 +556,14 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
d_ptr->algorithm = job.algorithm();
mutex.lock();
# ifdef XMRIG_ALGO_RANDOMX
bool ready = false;
# else
constexpr const bool ready = true;
# endif
{
std::lock_guard<std::mutex> lock(mutex);
const uint8_t index = donate ? 1 : 0;
@ -575,14 +582,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
}
# ifdef XMRIG_ALGO_RANDOMX
const bool ready = d_ptr->initRX();
ready = d_ptr->initRX();
// Always reset nonce on RandomX dataset change
if (!ready) {
d_ptr->reset = true;
}
# else
constexpr const bool ready = true;
# endif
# ifdef XMRIG_ALGO_GHOSTRIDER
@ -591,7 +596,7 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
}
# endif
mutex.unlock();
}
d_ptr->active = true;
d_ptr->m_taskbar.setActive(true);