Browse Source

Print summary on quit modes.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
71ce9bc88a
  1. 16
      main.c

16
main.c

@ -1879,6 +1879,8 @@ static void disable_curses(void) @@ -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) @@ -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) @@ -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, ...) @@ -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);

Loading…
Cancel
Save