Tests: cleanly exit from test apps on reception of SIGTERM
[lttng-tools.git] / tests / utils / testapp / gen-ust-events / gen-ust-events.c
index 3cfadbe9976a70aa6bdc16240707d49160ca01b0..c5dd31a355e1294229529a4ff20c3a3026bf8347 100644 (file)
@@ -32,6 +32,7 @@
 #include <poll.h>
 #include <errno.h>
 #include "utils.h"
+#include "signal-helper.h"
 
 #define TRACEPOINT_DEFINE
 #include "tp.h"
@@ -90,6 +91,11 @@ int main(int argc, char **argv)
        char *after_first_event_file_path = NULL;
        char *before_last_event_file_path = NULL;
 
+       if (set_signal_handler()) {
+               ret = -1;
+               goto end;
+       }
+
        if (argc >= 2) {
                /*
                 * If nr_iter is negative, do an infinite tracing loop.
@@ -133,6 +139,9 @@ int main(int argc, char **argv)
                                goto end;
                        }
                }
+               if (should_quit) {
+                       break;
+               }
        }
 
 end:
This page took 0.025202 seconds and 4 git commands to generate.