waiter: modernize the waiter interface
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.hpp
index 4058de5a4d89953b41b4d947dcc4f9e230b9ce70..8a3150ae32d72987b5c46a20b9096188649e97a1 100644 (file)
@@ -17,6 +17,8 @@
 #include <lttng/domain.h>
 #include <lttng/lttng-error.h>
 
+#include <vendor/optional.hpp>
+
 #include <stdbool.h>
 #include <urcu/rculfhash.h>
 
@@ -41,9 +43,9 @@ enum notification_thread_command_type {
 };
 
 struct notification_thread_command {
-       struct cds_list_head cmd_list_node;
+       struct cds_list_head cmd_list_node = {};
 
-       enum notification_thread_command_type type;
+       notification_thread_command_type type = NOTIFICATION_COMMAND_TYPE_QUIT;
        union {
                /* Register trigger. */
                struct {
@@ -108,7 +110,7 @@ struct notification_thread_command {
                        const struct lttng_trigger *trigger;
                } get_trigger;
 
-       } parameters;
+       } parameters = {};
 
        union {
                struct {
@@ -117,11 +119,12 @@ struct notification_thread_command {
                struct {
                        struct lttng_trigger *trigger;
                } get_trigger;
-       } reply;
-       /* lttng_waiter on which to wait for command reply (optional). */
-       struct lttng_waiter reply_waiter;
-       enum lttng_error_code reply_code;
-       bool is_async;
+       } reply = {};
+
+       /* Used to wake origin thread for synchroneous commands. */
+       nonstd::optional<lttng::synchro::waker> command_completed_waker = nonstd::nullopt;
+       lttng_error_code reply_code = LTTNG_ERR_UNK;
+       bool is_async = false;
 };
 
 enum lttng_error_code
This page took 0.023844 seconds and 4 git commands to generate.