This commit is contained in:
Artem Zuikov 2025-06-29 20:36:01 +07:00 committed by GitHub
commit eccb1ccc48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 26 deletions

View file

@ -180,11 +180,11 @@ public:
} }
# endif # endif
mutex.lock(); {
std::lock_guard<std::mutex> lock(mutex);
pages += status.hugePages(); pages += status.hugePages();
}
mutex.unlock();
rapidjson::Value hugepages; rapidjson::Value hugepages;
@ -380,14 +380,14 @@ void xmrig::CpuBackend::setJob(const Job &job)
void xmrig::CpuBackend::start(IWorker *worker, bool ready) void xmrig::CpuBackend::start(IWorker *worker, bool ready)
{ {
mutex.lock(); {
std::lock_guard<std::mutex> lock(mutex);
if (d_ptr->status.started(worker, ready)) { if (d_ptr->status.started(worker, ready)) {
d_ptr->status.print(); d_ptr->status.print();
}
} }
mutex.unlock();
if (ready) { if (ready) {
worker->start(); worker->start();
} }

View file

@ -465,16 +465,17 @@ void xmrig::CudaBackend::setJob(const Job &job)
void xmrig::CudaBackend::start(IWorker *worker, bool ready) void xmrig::CudaBackend::start(IWorker *worker, bool ready)
{ {
mutex.lock(); {
std::lock_guard<std::mutex> lock(mutex);
if (d_ptr->status.started(ready)) { if (d_ptr->status.started(ready)) {
d_ptr->status.print(); d_ptr->status.print();
CudaWorker::ready = true;
}
CudaWorker::ready = true;
} }
mutex.unlock();
if (ready) { if (ready) {
worker->start(); worker->start();
} }

View file

@ -447,16 +447,16 @@ void xmrig::OclBackend::setJob(const Job &job)
void xmrig::OclBackend::start(IWorker *worker, bool ready) void xmrig::OclBackend::start(IWorker *worker, bool ready)
{ {
mutex.lock(); {
std::lock_guard<std::mutex> lock(mutex);
if (d_ptr->status.started(ready)) { if (d_ptr->status.started(ready)) {
d_ptr->status.print(); d_ptr->status.print();
OclWorker::ready = true; OclWorker::ready = true;
}
} }
mutex.unlock();
if (ready) { if (ready) {
worker->start(); worker->start();
} }

View file

@ -569,7 +569,14 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
d_ptr->algorithm = job.algorithm(); 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; const uint8_t index = donate ? 1 : 0;
@ -588,14 +595,12 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
} }
# ifdef XMRIG_ALGO_RANDOMX # ifdef XMRIG_ALGO_RANDOMX
const bool ready = d_ptr->initRX(); ready = d_ptr->initRX();
// Always reset nonce on RandomX dataset change // Always reset nonce on RandomX dataset change
if (!ready) { if (!ready) {
d_ptr->reset = true; d_ptr->reset = true;
} }
# else
constexpr const bool ready = true;
# endif # endif
# ifdef XMRIG_ALGO_GHOSTRIDER # ifdef XMRIG_ALGO_GHOSTRIDER
@ -604,7 +609,7 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
} }
# endif # endif
mutex.unlock(); }
d_ptr->active = true; d_ptr->active = true;
d_ptr->m_taskbar.setActive(true); d_ptr->m_taskbar.setActive(true);