diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-30 16:06:32 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-12-30 16:06:32 +0000 |
commit | ed5d017c0f95cfec4a068c78684b98675027f74e (patch) | |
tree | 763f7001b6be6aa76f78b72a6e8f84eb84ea03eb /src | |
parent | core_tests: deinit core before destroying it (diff) | |
download | monero-ed5d017c0f95cfec4a068c78684b98675027f74e.tar.xz |
miner: minor fixes on stop
- only try to stop if actually started
- print number of threads before zeroing it
This fixes the suspiciously doubled "Mining has been stopped"
message on exit.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/miner.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptonote_core/miner.cpp b/src/cryptonote_core/miner.cpp index 00a474524..5fde94752 100644 --- a/src/cryptonote_core/miner.cpp +++ b/src/cryptonote_core/miner.cpp @@ -278,14 +278,17 @@ namespace cryptonote //----------------------------------------------------------------------------------------------------- bool miner::stop() { + if (!is_mining()) + return true; + send_stop_signal(); CRITICAL_REGION_LOCAL(m_threads_lock); BOOST_FOREACH(boost::thread& th, m_threads) th.join(); - m_threads.clear(); LOG_PRINT_L0("Mining has been stopped, " << m_threads.size() << " finished" ); + m_threads.clear(); return true; } //----------------------------------------------------------------------------------------------------- |