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 Hashrate *hashrate() const = 0;
|
||||||
virtual const String &profileName() const = 0;
|
virtual const String &profileName() const = 0;
|
||||||
virtual const String &type() const = 0;
|
virtual const String &type() const = 0;
|
||||||
|
virtual void prepare(const Job &nextJob) = 0;
|
||||||
virtual void printHashrate(bool details) = 0;
|
virtual void printHashrate(bool details) = 0;
|
||||||
virtual void setJob(const Job &job) = 0;
|
virtual void setJob(const Job &job) = 0;
|
||||||
virtual void start(IWorker *worker) = 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)
|
void xmrig::CpuBackend::printHashrate(bool details)
|
||||||
{
|
{
|
||||||
if (!details || !hashrate()) {
|
if (!details || !hashrate()) {
|
||||||
|
|
|
@ -49,6 +49,7 @@ protected:
|
||||||
const Hashrate *hashrate() const override;
|
const Hashrate *hashrate() const override;
|
||||||
const String &profileName() const override;
|
const String &profileName() const override;
|
||||||
const String &type() const override;
|
const String &type() const override;
|
||||||
|
void prepare(const Job &nextJob) override;
|
||||||
void printHashrate(bool details) override;
|
void printHashrate(bool details) override;
|
||||||
void setJob(const Job &job) override;
|
void setJob(const Job &job) override;
|
||||||
void start(IWorker *worker) 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)
|
void xmrig::Miner::setJob(const Job &job, bool donate)
|
||||||
{
|
{
|
||||||
|
for (IBackend *backend : d_ptr->backends) {
|
||||||
|
backend->prepare(job);
|
||||||
|
}
|
||||||
|
|
||||||
uv_rwlock_wrlock(&d_ptr->rwlock);
|
uv_rwlock_wrlock(&d_ptr->rwlock);
|
||||||
|
|
||||||
const uint8_t index = donate ? 1 : 0;
|
const uint8_t index = donate ? 1 : 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue