1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-05 11:34:16 +00:00

Print summary on quit modes.

This commit is contained in:
Con Kolivas 2011-09-01 23:15:42 +10:00
parent 8496534168
commit 71ce9bc88a

16
main.c
View File

@ -1879,6 +1879,8 @@ static void disable_curses(void)
}
}
static void print_summary(void);
void kill_work(void)
{
struct workio_cmd *wc;
@ -1928,14 +1930,22 @@ void kill_work(void)
applog(LOG_ERR, "Failed to tq_push work in kill_work");
exit (1);
}
thr = &thr_info[work_thr_id];
if (thr->pth)
pthread_cancel(*thr->pth);
}
void quit(int status, const char *format, ...);
static void sighandler(int sig)
{
/* Restore signal handlers so we can still quit if kill_work fails */
sigaction(SIGTERM, &termhandler, NULL);
sigaction(SIGINT, &inthandler, NULL);
kill_work();
quit(sig, "Received interrupt signal.");
}
static void *get_work_thread(void *userdata)
@ -2855,6 +2865,8 @@ static void *workio_thread(void *userdata)
struct thr_info *mythr = userdata;
bool ok = true;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
while (ok) {
struct workio_cmd *wc;
@ -4432,6 +4444,10 @@ void quit(int status, const char *format, ...)
va_list ap;
disable_curses();
if (!opt_realquiet && successful_connect)
print_summary();
if (format) {
va_start(ap, format);
vfprintf(stderr, format, ap);