Launch the timer thread using lttng_thread
[lttng-tools.git] / src / bin / lttng-sessiond / timer.c
index fa5e95cf194721bd5ff812ad1ea67fac9a312608..9915767657fdbdc790d4b8568cd6ecb710b8a40d 100644 (file)
@@ -24,6 +24,7 @@
 #include "timer.h"
 #include "health-sessiond.h"
 #include "rotation-thread.h"
+#include "thread.h"
 
 #define LTTNG_SESSIOND_SIG_QS                          SIGRTMIN + 10
 #define LTTNG_SESSIOND_SIG_EXIT                                SIGRTMIN + 11
@@ -344,7 +345,8 @@ int timer_signal_init(void)
 /*
  * This thread is the sighandler for the timer signals.
  */
-void *timer_thread_func(void *data)
+static
+void *thread_timer(void *data)
 {
        int signr;
        sigset_t mask;
@@ -414,7 +416,27 @@ end:
        return NULL;
 }
 
-void timer_exit(void)
+static
+bool shutdown_timer_thread(void *data)
+{
+       return kill(getpid(), LTTNG_SESSIOND_SIG_EXIT) == 0;
+}
+
+bool launch_timer_thread(
+               struct timer_thread_parameters *timer_thread_parameters)
 {
-       kill(getpid(), LTTNG_SESSIOND_SIG_EXIT);
+       struct lttng_thread *thread;
+
+       thread = lttng_thread_create("Timer",
+                       thread_timer,
+                       shutdown_timer_thread,
+                       NULL,
+                       timer_thread_parameters);
+       if (!thread) {
+               goto error;
+       }
+       lttng_thread_put(thread);
+       return true;
+error:
+       return false;
 }
This page took 0.025788 seconds and 5 git commands to generate.