From 58dc32dd97ceb8ec7b1eca149447a4faf144cc42 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:10:51 +0100 Subject: [PATCH] Tari poll loop - bring two exit checks together --- src/merge_mining_client_tari.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/merge_mining_client_tari.cpp b/src/merge_mining_client_tari.cpp index 3c49ce3..4a7157f 100644 --- a/src/merge_mining_client_tari.cpp +++ b/src/merge_mining_client_tari.cpp @@ -187,13 +187,9 @@ void MergeMiningClientTari::run() LOGINFO(6, "Tari height = " << response2.block().header().height()); - if (m_workerStop.load() != 0) { - return; - } - const int64_t timeout = std::max(500'000'000 - duration_cast(high_resolution_clock::now() - t1).count(), 1'000'000); - if (uv_cond_timedwait(&m_workerCond, &m_workerLock, timeout) != UV_ETIMEDOUT) { + if ((m_workerStop.load() != 0) || (uv_cond_timedwait(&m_workerCond, &m_workerLock, timeout) != UV_ETIMEDOUT)) { return; } }