aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-01 17:20:25 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-01 17:20:25 +0200
commit574c399386f95f61d9e0fb3e929eaab85203c315 (patch)
treec9125f5a69d520fefbbbb28e5d3ade2ee91ddf32 /src/cryptonote_basic
parentMerge pull request #5289 (diff)
parentminer: fix possible exit crash due to race in stop (diff)
downloadmonero-574c399386f95f61d9e0fb3e929eaab85203c315.tar.xz
Merge pull request #5288
39f000b3 miner: fix possible exit crash due to race in stop (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/miner.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp
index 6628c8448..4e2edc20f 100644
--- a/src/cryptonote_basic/miner.cpp
+++ b/src/cryptonote_basic/miner.cpp
@@ -435,14 +435,15 @@ namespace cryptonote
{
MTRACE("Miner has received stop signal");
- if (!is_mining())
+ CRITICAL_REGION_LOCAL(m_threads_lock);
+ bool mining = !m_threads.empty();
+ if (!mining)
{
MTRACE("Not mining - nothing to stop" );
return true;
}
send_stop_signal();
- CRITICAL_REGION_LOCAL(m_threads_lock);
// In case background mining was active and the miner threads are waiting
// on the background miner to signal start.