Browse Source

Enable curses after the mining threads are set up so that failure messages won't be lost in the curses interface.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
4cc08fe459
  1. 44
      main.c

44
main.c

@ -4481,9 +4481,28 @@ out:
} }
#endif // defined(unix) #endif // defined(unix)
static void enable_curses(void) {
int x,y;
if (curses_active)
return;
mainwin = initscr();
getmaxyx(mainwin, y, x);
statuswin = newwin(logstart, x, 0, 0);
leaveok(statuswin, true);
logwin = newwin(y - logcursor, 0, logcursor, 0);
idlok(logwin, true);
scrollok(logwin, true);
leaveok(logwin, true);
cbreak();
noecho();
test_and_set(&curses_active);
}
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
unsigned int i, x, y, pools_active = 0; unsigned int i, pools_active = 0;
struct block *block, *tmpblock; struct block *block, *tmpblock;
struct work *work, *tmpwork; struct work *work, *tmpwork;
struct sigaction handler; struct sigaction handler;
@ -4672,28 +4691,14 @@ int main (int argc, char *argv[])
logstart = cpucursor + (opt_n_threads ? num_processors : 0) + 1; logstart = cpucursor + (opt_n_threads ? num_processors : 0) + 1;
logcursor = logstart + 1; logcursor = logstart + 1;
/* Set up the ncurses interface */ if (opt_realquiet)
if (!opt_realquiet && use_curses) { use_curses = false;
mainwin = initscr();
getmaxyx(mainwin, y, x);
statuswin = newwin(logstart, x, 0, 0);
leaveok(statuswin, true);
logwin = newwin(y - logcursor, 0, logcursor, 0);
idlok(logwin, true);
scrollok(logwin, true);
leaveok(logwin, true);
cbreak();
noecho();
test_and_set(&curses_active);
}
if (!total_pools) { if (!total_pools) {
if (curses_active) { enable_curses();
applog(LOG_WARNING, "Need to specify at least one pool server."); applog(LOG_WARNING, "Need to specify at least one pool server.");
if (!input_pool(false)) if (!input_pool(false))
quit(1, "Pool setup failed"); quit(1, "Pool setup failed");
} else
quit(1, "No server specified");
} }
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
@ -4910,6 +4915,9 @@ int main (int argc, char *argv[])
opt_n_threads, opt_n_threads,
algo_names[opt_algo]); algo_names[opt_algo]);
if (use_curses)
enable_curses();
watchdog_thr_id = mining_threads + 2; watchdog_thr_id = mining_threads + 2;
thr = &thr_info[watchdog_thr_id]; thr = &thr_info[watchdog_thr_id];
/* start wakeup thread */ /* start wakeup thread */

Loading…
Cancel
Save