Merge pull request #1870 from cohcho/fix_miner_state_machine

Miner: fix state machine
This commit is contained in:
xmrig 2020-10-07 12:25:17 +07:00 committed by GitHub
commit ba47219185
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 21 deletions

View file

@ -134,8 +134,6 @@ public:
Nonce::pause(true);
}
active = true;
if (reset) {
Nonce::reset(job.index());
}
@ -146,7 +144,7 @@ public:
Nonce::touch();
if (enabled) {
if (active && enabled) {
Nonce::pause(false);
}
@ -536,6 +534,8 @@ void xmrig::Miner::setJob(const Job &job, bool donate)
mutex.unlock();
d_ptr->active = true;
if (ready) {
d_ptr->handleJobChange();
}

View file

@ -28,28 +28,14 @@
namespace xmrig {
std::atomic<bool> Nonce::m_paused;
std::atomic<uint64_t> Nonce::m_sequence[Nonce::MAX];
std::atomic<bool> Nonce::m_paused = {true};
std::atomic<uint64_t> Nonce::m_sequence[Nonce::MAX] = { {1}, {1}, {1} };
std::atomic<uint64_t> Nonce::m_nonces[2] = { {0}, {0} };
static Nonce nonce;
} // namespace xmrig
xmrig::Nonce::Nonce()
{
m_paused = true;
for (auto &i : m_sequence) {
i = 1;
}
}
bool xmrig::Nonce::next(uint8_t index, uint32_t *nonce, uint32_t reserveCount, uint64_t mask)
{
mask &= 0x7FFFFFFFFFFFFFFFULL;

View file

@ -43,8 +43,6 @@ public:
};
Nonce();
static inline bool isOutdated(Backend backend, uint64_t sequence) { return m_sequence[backend].load(std::memory_order_relaxed) != sequence; }
static inline bool isPaused() { return m_paused.load(std::memory_order_relaxed); }
static inline uint64_t sequence(Backend backend) { return m_sequence[backend].load(std::memory_order_relaxed); }