Skip to content

Commit

Permalink
THREAD
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Feb 10, 2024
1 parent 4016f26 commit f62873d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nano/lib/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
3 changes: 3 additions & 0 deletions nano/lib/thread_roles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
1 change: 1 addition & 0 deletions nano/test_common/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ void nano::test::system::stop ()
{
i->stop ();
}
stats.stop ();
work.stop ();
}

Expand Down

0 comments on commit f62873d

Please sign in to comment.