[gtk] profiler: Exit gracefully on SIGTERM
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] profiler: Exit gracefully on SIGTERM
- Date: Thu, 30 Jan 2020 09:06:04 +0000 (UTC)
commit 929d325560a206e78d1c4afba5ae3b22605ea954
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 29 16:55:44 2020 +0100
profiler: Exit gracefully on SIGTERM
This is nice, since it lets me quickly launch a test app
and terminate it with Ctrl-C and still produce a usable
sysprof trace.
gdk/gdkprofiler.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkprofiler.c b/gdk/gdkprofiler.c
index 93055ac9a8..5b4e976110 100644
--- a/gdk/gdkprofiler.c
+++ b/gdk/gdkprofiler.c
@@ -21,6 +21,7 @@
#include "config.h"
#include <sys/types.h>
+#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -38,7 +39,7 @@ static SysprofCaptureWriter *writer = NULL;
static gboolean running = FALSE;
static void
-profiler_stop (void)
+profiler_stop (int s)
{
if (writer)
sysprof_capture_writer_unref (writer);
@@ -67,7 +68,8 @@ gdk_profiler_start (int fd)
if (writer)
running = TRUE;
- atexit (profiler_stop);
+ atexit (G_CALLBACK (profiler_stop));
+ signal (SIGTERM, profiler_stop);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]