From 7dc987ab2c00d04d67da690d8a8edc68611f63b2 Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Mon, 14 Apr 2025 13:39:37 +0200 Subject: [PATCH] maybe fix race condition --- src/gameske_funkce.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gameske_funkce.cpp b/src/gameske_funkce.cpp index 57ffa79..3f2d4af 100644 --- a/src/gameske_funkce.cpp +++ b/src/gameske_funkce.cpp @@ -158,6 +158,7 @@ std::string spawncmd() { } void async_clock(WINDOW* win) { + std::this_thread::sleep_for(std::chrono::milliseconds(150)); while (true) { auto now = std::chrono::system_clock::now(); std::string time_str; @@ -186,13 +187,15 @@ void async_clock(WINDOW* win) { } void show_clock_text(WINDOW* text_win) { - std::this_thread::sleep_for(std::chrono::seconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); wborder(text_win, 0, ' ', 0, 0, 0, ACS_HLINE, 0, ACS_HLINE); mvwprintw(text_win, 1, 1, "správný čas na podání trestního oznámení je"); wrefresh(text_win); } void async_clock_init() { + // program only launches sometimes i think there is race condition + //memory leak WINDOW* win = newwin(3, 10, LINES - 3, COLS - 10); box(win, 0, 0);