diff --git a/nano/lib/stats.cpp b/nano/lib/stats.cpp index cc6769376b..437936004a 100644 --- a/nano/lib/stats.cpp +++ b/nano/lib/stats.cpp @@ -147,8 +147,15 @@ void nano::stats::start () void nano::stats::stop () { - std::lock_guard guard{ mutex }; - stopped = true; + { + std::lock_guard guard{ mutex }; + stopped = true; + } + condition.notify_all (); + if (thread.joinable ()) + { + thread.join (); + } } void nano::stats::clear () diff --git a/nano/lib/thread_roles.cpp b/nano/lib/thread_roles.cpp index 0824d23733..b0d3825b2d 100644 --- a/nano/lib/thread_roles.cpp +++ b/nano/lib/thread_roles.cpp @@ -100,6 +100,9 @@ std::string nano::thread_role::get_string (nano::thread_role::name role) case nano::thread_role::name::scheduler_priority: thread_role_name_string = "Sched Priority"; break; + case nano::thread_role::name::stats: + thread_role_name_string = "Stats"; + break; default: debug_assert (false && "nano::thread_role::get_string unhandled thread role"); } diff --git a/nano/test_common/system.cpp b/nano/test_common/system.cpp index e8fccf2200..e0f5d1f772 100644 --- a/nano/test_common/system.cpp +++ b/nano/test_common/system.cpp @@ -570,6 +570,7 @@ void nano::test::system::stop () { i->stop (); } + stats.stop (); work.stop (); }