Browse Source

Clear log window from consistent place. No need for locking since logging is disabled during input.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
8d4fbc3258
  1. 13
      main.c

13
main.c

@ -817,10 +817,8 @@ void log_curses(const char *f, va_list ap)
static void clear_logwin(void) static void clear_logwin(void)
{ {
pthread_mutex_lock(&curses_lock);
wclear(logwin); wclear(logwin);
wrefresh(logwin); wrefresh(logwin);
pthread_mutex_unlock(&curses_lock);
} }
static bool submit_upstream_work(const struct work *work) 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, "[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, "[C]hange management strategy [S]witch pool [I]nformation\n");
wprintw(logwin, "Or press any other key to continue\n"); wprintw(logwin, "Or press any other key to continue\n");
wrefresh(logwin);
input = getch(); input = getch();
if (!strncasecmp(&input, "a", 1)) { if (!strncasecmp(&input, "a", 1)) {
@ -1602,6 +1601,7 @@ static void display_options(void)
opt_loginput = true; opt_loginput = true;
immedok(logwin, true); immedok(logwin, true);
retry: retry:
clear_logwin();
wprintw(logwin, "\nToggle: [D]ebug [N]ormal [S]ilent [V]erbose [R]PC debug\n"); 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, "[L]og interval [C]lear\n");
wprintw(logwin, "Select an option or any other key to return\n"); wprintw(logwin, "Select an option or any other key to return\n");
@ -1636,7 +1636,8 @@ retry:
} }
opt_log_interval = selected; opt_log_interval = selected;
} }
wclear(logwin);
clear_logwin();
immedok(logwin, false); immedok(logwin, false);
opt_loginput = false; opt_loginput = false;
} }
@ -1649,7 +1650,7 @@ static void set_options(void)
opt_loginput = true; opt_loginput = true;
immedok(logwin, true); immedok(logwin, true);
retry: retry:
wclear(logwin); clear_logwin();
wprintw(logwin, "\n[D]ynamic mode: %s\n[L]ongpoll: %s\n", wprintw(logwin, "\n[D]ynamic mode: %s\n[L]ongpoll: %s\n",
opt_dynamic ? "On" : "Off", want_longpoll ? "On" : "Off"); opt_dynamic ? "On" : "Off", want_longpoll ? "On" : "Off");
if (opt_dynamic) 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", 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); opt_queue, opt_scantime, opt_retries, opt_fail_pause);
wprintw(logwin, "Select an option or any other key to return\n"); wprintw(logwin, "Select an option or any other key to return\n");
wrefresh(logwin);
input = getch(); input = getch();
if (!strncasecmp(&input, "q", 1)) { if (!strncasecmp(&input, "q", 1)) {
@ -1711,7 +1713,8 @@ retry:
opt_fail_pause = selected; opt_fail_pause = selected;
goto retry; goto retry;
} }
wclear(logwin);
clear_logwin();
immedok(logwin, false); immedok(logwin, false);
opt_loginput = false; opt_loginput = false;
} }

Loading…
Cancel
Save