Use compiler-agnostic defines to silence warning
[lttng-tools.git] / src / bin / lttng-sessiond / timer.cpp
index 243b562190d12e3656e438c561f25aba4bc8215b..b70d648499c7e8744a07443355fd5f5a62e18b99 100644 (file)
@@ -199,15 +199,16 @@ end:
        return ret;
 }
 
-int timer_session_rotation_pending_check_start(struct ltt_session *session,
+int timer_session_rotation_pending_check_start(const ltt_session::locked_ref& session,
                                               unsigned int interval_us)
 {
        int ret;
 
-       if (!session_get(session)) {
+       if (!session_get(&session.get())) {
                ret = -1;
                goto end;
        }
+
        DBG("Enabling session rotation pending check timer on session %" PRIu64, session->id);
        /*
         * We arm this timer in a one-shot mode so we don't have to disable it
@@ -219,7 +220,7 @@ int timer_session_rotation_pending_check_start(struct ltt_session *session,
         * no need to go through the whole signal teardown scheme everytime.
         */
        ret = timer_start(&session->rotation_pending_check_timer,
-                         session,
+                         &session.get(),
                          interval_us,
                          LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK,
                          /* one-shot */ true);
@@ -231,13 +232,12 @@ end:
 }
 
 /*
- * Call with session and session_list locks held.
+ * Call with session_list lock held.
  */
-int timer_session_rotation_pending_check_stop(struct ltt_session *session)
+int timer_session_rotation_pending_check_stop(const ltt_session::locked_ref& session)
 {
        int ret;
 
-       LTTNG_ASSERT(session);
        LTTNG_ASSERT(session->rotation_pending_check_timer_enabled);
 
        DBG("Disabling session rotation pending check timer on session %" PRIu64, session->id);
@@ -250,20 +250,21 @@ int timer_session_rotation_pending_check_stop(struct ltt_session *session)
                /*
                 * The timer's reference to the session can be released safely.
                 */
-               session_put(session);
+               session_put(&session.get());
        }
+
        return ret;
 }
 
 /*
- * Call with session and session_list locks held.
+ * Call with session_list lock held.
  */
-int timer_session_rotation_schedule_timer_start(struct ltt_session *session,
+int timer_session_rotation_schedule_timer_start(const ltt_session::locked_ref& session,
                                                unsigned int interval_us)
 {
        int ret;
 
-       if (!session_get(session)) {
+       if (!session_get(&session.get())) {
                ret = -1;
                goto end;
        }
@@ -272,7 +273,7 @@ int timer_session_rotation_schedule_timer_start(struct ltt_session *session,
            interval_us,
            USEC_UNIT);
        ret = timer_start(&session->rotation_schedule_timer,
-                         session,
+                         &session.get(),
                          interval_us,
                          LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION,
                          /* one-shot */ false);
@@ -287,12 +288,10 @@ end:
 /*
  * Call with session and session_list locks held.
  */
-int timer_session_rotation_schedule_timer_stop(struct ltt_session *session)
+int timer_session_rotation_schedule_timer_stop(const ltt_session::locked_ref& session)
 {
        int ret = 0;
 
-       LTTNG_ASSERT(session);
-
        if (!session->rotation_schedule_timer_enabled) {
                goto end;
        }
@@ -306,7 +305,7 @@ int timer_session_rotation_schedule_timer_stop(struct ltt_session *session)
 
        session->rotation_schedule_timer_enabled = false;
        /* The timer's reference to the session can be released safely. */
-       session_put(session);
+       session_put(&session.get());
        ret = 0;
 end:
        return ret;
@@ -379,13 +378,15 @@ static void *thread_timer(void *data)
                        struct ltt_session *session =
                                (struct ltt_session *) info.si_value.sival_ptr;
 
-                       rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
-                                                   ROTATION_THREAD_JOB_TYPE_CHECK_PENDING_ROTATION,
-                                                   session);
+                       rotation_thread_enqueue_job(
+                               ctx->rotation_thread_job_queue,
+                               lttng::sessiond::rotation_thread_job_type::CHECK_PENDING_ROTATION,
+                               session);
                } else if (signr == LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION) {
-                       rotation_thread_enqueue_job(ctx->rotation_thread_job_queue,
-                                                   ROTATION_THREAD_JOB_TYPE_SCHEDULED_ROTATION,
-                                                   (struct ltt_session *) info.si_value.sival_ptr);
+                       rotation_thread_enqueue_job(
+                               ctx->rotation_thread_job_queue,
+                               lttng::sessiond::rotation_thread_job_type::SCHEDULED_ROTATION,
+                               (struct ltt_session *) info.si_value.sival_ptr);
                        /*
                         * The scheduled periodic rotation timer is not in
                         * "one-shot" mode. The reference to the session is not
This page took 0.033804 seconds and 4 git commands to generate.