mirror of
https://github.com/xmrig/xmrig.git
synced 2025-01-22 18:54:43 +00:00
Merge pull request #1870 from cohcho/fix_miner_state_machine
Miner: fix state machine
This commit is contained in:
commit
ba47219185
3 changed files with 5 additions and 21 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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); }
|
||||
|
|
Loading…
Reference in a new issue