mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-10 14:04:16 +00:00
Print summary on quit modes.
This commit is contained in:
parent
8496534168
commit
71ce9bc88a
16
main.c
16
main.c
@ -1879,6 +1879,8 @@ static void disable_curses(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_summary(void);
|
||||||
|
|
||||||
void kill_work(void)
|
void kill_work(void)
|
||||||
{
|
{
|
||||||
struct workio_cmd *wc;
|
struct workio_cmd *wc;
|
||||||
@ -1928,14 +1930,22 @@ void kill_work(void)
|
|||||||
applog(LOG_ERR, "Failed to tq_push work in kill_work");
|
applog(LOG_ERR, "Failed to tq_push work in kill_work");
|
||||||
exit (1);
|
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)
|
static void sighandler(int sig)
|
||||||
{
|
{
|
||||||
/* Restore signal handlers so we can still quit if kill_work fails */
|
/* Restore signal handlers so we can still quit if kill_work fails */
|
||||||
sigaction(SIGTERM, &termhandler, NULL);
|
sigaction(SIGTERM, &termhandler, NULL);
|
||||||
sigaction(SIGINT, &inthandler, NULL);
|
sigaction(SIGINT, &inthandler, NULL);
|
||||||
kill_work();
|
kill_work();
|
||||||
|
|
||||||
|
quit(sig, "Received interrupt signal.");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *get_work_thread(void *userdata)
|
static void *get_work_thread(void *userdata)
|
||||||
@ -2855,6 +2865,8 @@ static void *workio_thread(void *userdata)
|
|||||||
struct thr_info *mythr = userdata;
|
struct thr_info *mythr = userdata;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
|
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
|
||||||
|
|
||||||
while (ok) {
|
while (ok) {
|
||||||
struct workio_cmd *wc;
|
struct workio_cmd *wc;
|
||||||
|
|
||||||
@ -4432,6 +4444,10 @@ void quit(int status, const char *format, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
disable_curses();
|
disable_curses();
|
||||||
|
|
||||||
|
if (!opt_realquiet && successful_connect)
|
||||||
|
print_summary();
|
||||||
|
|
||||||
if (format) {
|
if (format) {
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vfprintf(stderr, format, ap);
|
vfprintf(stderr, format, ap);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user