X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fcursesdisplay.c;h=c8ac5db55f93c8a990adcbd699f29d6dd3c5396e;hb=ae9e85c7301dea169bc50c91d927eccd2c944e92;hp=8c1a3baf6069508e71e628fbef40bfb28c5c592e;hpb=7d9ea41ad08db5402c3d569b067e40a93501a6f1;p=lttngtop.git diff --git a/src/cursesdisplay.c b/src/cursesdisplay.c index 8c1a3ba..c8ac5db 100644 --- a/src/cursesdisplay.c +++ b/src/cursesdisplay.c @@ -74,11 +74,13 @@ void reset_ncurses() { curs_set(1); endwin(); - exit(0); + quit = 1; } static void handle_sigterm(int signal) { + fprintf(stderr, "caugh signal\n"); + pthread_cancel(keyboard_thread); reset_ncurses(); } @@ -119,6 +121,7 @@ void init_screen() define_key("\033[17;2~", KEY_F(18)); } signal(SIGTERM, handle_sigterm); + signal(SIGINT, handle_sigterm); mousemask(BUTTON1_CLICKED, NULL); refresh(); } @@ -302,23 +305,6 @@ void basic_header() wrefresh(header); } -struct tm format_timestamp(uint64_t timestamp) -{ - struct tm tm; - uint64_t ts_sec = 0, ts_nsec; - time_t time_s; - - ts_nsec = timestamp; - ts_sec += ts_nsec / NSEC_PER_SEC; - ts_nsec = ts_nsec % NSEC_PER_SEC; - - time_s = (time_t) ts_sec; - - localtime_r(&time_s, &tm); - - return tm; -} - static void scale_unit(uint64_t bytes, char *ret) { if (bytes >= 1000000000) @@ -1508,6 +1494,8 @@ void *handle_keyboard(void *p) case KEY_F(10): case 'q': reset_ncurses(); + /* exit keyboard thread */ + pthread_exit(0); break; case 't': toggle_threads *= -1; @@ -1519,7 +1507,6 @@ void *handle_keyboard(void *p) } else { resume_display(); } - break; case 'r': toggle_pref_panel(); break;