Browse Source

Make curses completely inactivated in quiet mode and do not update curses code in wakeup thread when curses is inactive.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
222d4ee6bf
  1. 56
      main.c

56
main.c

@ -1706,16 +1706,18 @@ static void *wakeup_thread(void *userdata)
hashmeter(-1, &zero_tv, 0); hashmeter(-1, &zero_tv, 0);
pthread_mutex_lock(&curses_lock); if (curses_active) {
getmaxyx(mainwin, y, x); pthread_mutex_lock(&curses_lock);
getmaxyx(logwin, logy, logx); getmaxyx(mainwin, y, x);
y -= logcursor; getmaxyx(logwin, logy, logx);
/* Detect screen size change */ y -= logcursor;
if (x != logx || y != logy) /* Detect screen size change */
wresize(logwin, y, x); if (x != logx || y != logy)
redrawwin(logwin); wresize(logwin, y, x);
redrawwin(statuswin); redrawwin(logwin);
pthread_mutex_unlock(&curses_lock); redrawwin(statuswin);
pthread_mutex_unlock(&curses_lock);
}
if (unlikely(work_restart[stage_thr_id].restart)) { if (unlikely(work_restart[stage_thr_id].restart)) {
restart_threads(false); restart_threads(false);
@ -1976,17 +1978,19 @@ int main (int argc, char *argv[])
pthread_mutex_unlock(&hash_lock); pthread_mutex_unlock(&hash_lock);
/* Set up the ncurses interface */ /* Set up the ncurses interface */
mainwin = initscr(); if (!opt_quiet) {
statuswin = newwin(logstart, 80, 0, 0); mainwin = initscr();
getmaxyx(mainwin, y, x); statuswin = newwin(logstart, 80, 0, 0);
logwin = newwin(y - logcursor, 0, logcursor, 0); getmaxyx(mainwin, y, x);
idlok(logwin, true); logwin = newwin(y - logcursor, 0, logcursor, 0);
scrollok(logwin, true); idlok(logwin, true);
leaveok(logwin, true); scrollok(logwin, true);
leaveok(statuswin, true); leaveok(logwin, true);
curses_active = true; leaveok(statuswin, true);
for (i = 0; i < mining_threads; i++) curses_active = true;
print_status(i); for (i = 0; i < mining_threads; i++)
print_status(i);
}
/* Now that everything's ready put enough work in the queue */ /* Now that everything's ready put enough work in the queue */
for (i = 0; i < opt_queue + mining_threads; i++) { for (i = 0; i < opt_queue + mining_threads; i++) {
@ -2006,10 +2010,12 @@ int main (int argc, char *argv[])
applog(LOG_INFO, "workio thread dead, exiting."); applog(LOG_INFO, "workio thread dead, exiting.");
delwin(logwin); if (curses_active) {
delwin(statuswin); delwin(logwin);
endwin(); delwin(statuswin);
refresh(); endwin();
refresh();
}
return 0; return 0;
} }

Loading…
Cancel
Save