Clear log window from consistent place. No need for locking since logging is disabled during input.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
diff --git a/main.c b/main.c
index c978cf3..ed03a0a 100644
--- a/main.c
+++ b/main.c
@@ -817,10 +817,8 @@ void log_curses(const char *f, va_list ap)
static void clear_logwin(void)
{
- pthread_mutex_lock(&curses_lock);
wclear(logwin);
wrefresh(logwin);
- pthread_mutex_unlock(&curses_lock);
}
static bool submit_upstream_work(const struct work *work)
@@ -1497,6 +1495,7 @@ retry:
wprintw(logwin, "[A]dd pool [R]emove pool [D]isable pool [E]nable pool\n");
wprintw(logwin, "[C]hange management strategy [S]witch pool [I]nformation\n");
wprintw(logwin, "Or press any other key to continue\n");
+ wrefresh(logwin);
input = getch();
if (!strncasecmp(&input, "a", 1)) {
@@ -1602,6 +1601,7 @@ static void display_options(void)
opt_loginput = true;
immedok(logwin, true);
retry:
+ clear_logwin();
wprintw(logwin, "\nToggle: [D]ebug [N]ormal [S]ilent [V]erbose [R]PC debug\n");
wprintw(logwin, "[L]og interval [C]lear\n");
wprintw(logwin, "Select an option or any other key to return\n");
@@ -1636,7 +1636,8 @@ retry:
}
opt_log_interval = selected;
}
- wclear(logwin);
+
+ clear_logwin();
immedok(logwin, false);
opt_loginput = false;
}
@@ -1649,7 +1650,7 @@ static void set_options(void)
opt_loginput = true;
immedok(logwin, true);
retry:
- wclear(logwin);
+ clear_logwin();
wprintw(logwin, "\n[D]ynamic mode: %s\n[L]ongpoll: %s\n",
opt_dynamic ? "On" : "Off", want_longpoll ? "On" : "Off");
if (opt_dynamic)
@@ -1659,6 +1660,7 @@ retry:
wprintw(logwin, "[Q]ueue: %d\n[S]cantime: %d\n[R]etries: %d\n[P]ause: %d\n",
opt_queue, opt_scantime, opt_retries, opt_fail_pause);
wprintw(logwin, "Select an option or any other key to return\n");
+ wrefresh(logwin);
input = getch();
if (!strncasecmp(&input, "q", 1)) {
@@ -1711,7 +1713,8 @@ retry:
opt_fail_pause = selected;
goto retry;
}
- wclear(logwin);
+
+ clear_logwin();
immedok(logwin, false);
opt_loginput = false;
}