X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftimer.c;h=9915767657fdbdc790d4b8568cd6ecb710b8a40d;hp=fa5e95cf194721bd5ff812ad1ea67fac9a312608;hb=bc26e826ebd59d3888e6db0d4985cfb3444f5c09;hpb=64d9b072ae17f9d2b9cc320ddef3dbe373761a93 diff --git a/src/bin/lttng-sessiond/timer.c b/src/bin/lttng-sessiond/timer.c index fa5e95cf1..991576765 100644 --- a/src/bin/lttng-sessiond/timer.c +++ b/src/bin/lttng-sessiond/timer.c @@ -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; }