Update example homescreen. Wait for the thread to join. (#129)

This commit is contained in:
Arthur Sonzogni 2021-06-26 01:37:18 +02:00 committed by GitHub
parent 8e98928c0c
commit 2ea480f4f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,8 +360,9 @@ int main(int argc, const char* argv[]) {
}); });
}); });
std::thread update([&screen, &shift]() { bool refresh_ui_continue = true;
for (;;) { std::thread refresh_ui([&] {
while(refresh_ui_continue) {
using namespace std::chrono_literals; using namespace std::chrono_literals;
std::this_thread::sleep_for(0.05s); std::this_thread::sleep_for(0.05s);
shift++; shift++;
@ -370,6 +371,8 @@ int main(int argc, const char* argv[]) {
}); });
screen.Loop(main_renderer); screen.Loop(main_renderer);
refresh_ui_continue = false;
refresh_ui.join();
return 0; return 0;
} }