diff --git a/examples/component/homescreen.cpp b/examples/component/homescreen.cpp index 3217ede..abeff69 100644 --- a/examples/component/homescreen.cpp +++ b/examples/component/homescreen.cpp @@ -360,8 +360,9 @@ int main(int argc, const char* argv[]) { }); }); - std::thread update([&screen, &shift]() { - for (;;) { + bool refresh_ui_continue = true; + std::thread refresh_ui([&] { + while(refresh_ui_continue) { using namespace std::chrono_literals; std::this_thread::sleep_for(0.05s); shift++; @@ -370,6 +371,8 @@ int main(int argc, const char* argv[]) { }); screen.Loop(main_renderer); + refresh_ui_continue = false; + refresh_ui.join(); return 0; }