mirror of
https://github.com/xmrig/xmrig.git
synced 2025-02-02 03:06:30 +00:00
Fixed miner freeze when switch between RandomX variants.
This commit is contained in:
parent
ef2454b025
commit
ab02bd9847
4 changed files with 15 additions and 0 deletions
|
@ -52,6 +52,7 @@ public:
|
|||
virtual const Hashrate *hashrate() const = 0;
|
||||
virtual const String &profileName() const = 0;
|
||||
virtual const String &type() const = 0;
|
||||
virtual void prepare(const Job &nextJob) = 0;
|
||||
virtual void printHashrate(bool details) = 0;
|
||||
virtual void setJob(const Job &job) = 0;
|
||||
virtual void start(IWorker *worker) = 0;
|
||||
|
|
|
@ -170,6 +170,15 @@ const xmrig::String &xmrig::CpuBackend::type() const
|
|||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::prepare(const Job &nextJob)
|
||||
{
|
||||
if (nextJob.algorithm().family() == Algorithm::RANDOM_X && nextJob.algorithm() != d_ptr->algo) {
|
||||
d_ptr->workers.stop();
|
||||
d_ptr->threads.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void xmrig::CpuBackend::printHashrate(bool details)
|
||||
{
|
||||
if (!details || !hashrate()) {
|
||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
|||
const Hashrate *hashrate() const override;
|
||||
const String &profileName() const override;
|
||||
const String &type() const override;
|
||||
void prepare(const Job &nextJob) override;
|
||||
void printHashrate(bool details) override;
|
||||
void setJob(const Job &job) override;
|
||||
void start(IWorker *worker) override;
|
||||
|
|
|
@ -352,6 +352,10 @@ void xmrig::Miner::setEnabled(bool enabled)
|
|||
|
||||
void xmrig::Miner::setJob(const Job &job, bool donate)
|
||||
{
|
||||
for (IBackend *backend : d_ptr->backends) {
|
||||
backend->prepare(job);
|
||||
}
|
||||
|
||||
uv_rwlock_wrlock(&d_ptr->rwlock);
|
||||
|
||||
const uint8_t index = donate ? 1 : 0;
|
||||
|
|
Loading…
Reference in a new issue