mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-07 07:55:04 -05:00
Fixed exit condition for RxQueue.
This commit is contained in:
@@ -132,15 +132,15 @@ bool xmrig::RxQueue::isReadyUnsafe(const Job &job) const
|
|||||||
|
|
||||||
void xmrig::RxQueue::backgroundInit()
|
void xmrig::RxQueue::backgroundInit()
|
||||||
{
|
{
|
||||||
while (true) {
|
while (m_state != STATE_SHUTDOWN) {
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
if (m_state == STATE_IDLE) {
|
if (m_state == STATE_IDLE) {
|
||||||
m_cv.wait(lock, [this]{ return m_state != STATE_IDLE; });
|
m_cv.wait(lock, [this]{ return m_state != STATE_IDLE; });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_state == STATE_SHUTDOWN) {
|
if (m_state != STATE_PENDING) {
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto item = m_queue.back();
|
const auto item = m_queue.back();
|
||||||
@@ -159,7 +159,8 @@ void xmrig::RxQueue::backgroundInit()
|
|||||||
m_storage->init(item.seed, item.threads, item.hugePages);
|
m_storage->init(item.seed, item.threads, item.hugePages);
|
||||||
|
|
||||||
lock = std::move(std::unique_lock<std::mutex>(m_mutex));
|
lock = std::move(std::unique_lock<std::mutex>(m_mutex));
|
||||||
if (!m_queue.empty()) {
|
|
||||||
|
if (m_state == STATE_SHUTDOWN || !m_queue.empty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user