Check for pending notification on notification channel activity
[lttng-tools.git] / src / bin / lttng-sessiond / rotation-thread.c
index 2fed39fc75a5051fb1b72d006ac95db528075ad8..e6b9b6a1e72790702a7d96e1412dd3bcadc43662 100644 (file)
@@ -682,11 +682,25 @@ int handle_notification_channel(int fd, uint32_t revents,
                struct rotation_thread_state *state)
 {
        int ret;
                struct rotation_thread_state *state)
 {
        int ret;
-       struct lttng_notification *notification;
+       bool notification_pending;
+       struct lttng_notification *notification = NULL;
        enum lttng_notification_channel_status status;
        const struct lttng_evaluation *notification_evaluation;
        const struct lttng_condition *notification_condition;
 
        enum lttng_notification_channel_status status;
        const struct lttng_evaluation *notification_evaluation;
        const struct lttng_condition *notification_condition;
 
+       status = lttng_notification_channel_has_pending_notification(
+                       rotate_notification_channel, &notification_pending);
+       if (status != LTTNG_NOTIFICATION_CHANNEL_STATUS_OK) {
+               ERR("[rotation-thread ]Error occured while checking for pending notification");
+               ret = -1;
+               goto end;
+       }
+
+       if (!notification_pending) {
+               ret = 0;
+               goto end;
+       }
+
        /* Receive the next notification. */
        status = lttng_notification_channel_get_next_notification(
                        rotate_notification_channel,
        /* Receive the next notification. */
        status = lttng_notification_channel_get_next_notification(
                        rotate_notification_channel,
This page took 0.024631 seconds and 5 git commands to generate.