X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fnotification-thread.h;h=2169b2efb69968b2e82ff83434abf45ec904050b;hp=a9c771104d48118a1a61ce65008f8df9b76c3439;hb=731c1b1217bdbb47501426a6a0a2220ce4bc442c;hpb=74df9916833ae6a69520c1a49ddce44ba3eea078 diff --git a/src/bin/lttng-sessiond/notification-thread.h b/src/bin/lttng-sessiond/notification-thread.h index a9c771104..2169b2efb 100644 --- a/src/bin/lttng-sessiond/notification-thread.h +++ b/src/bin/lttng-sessiond/notification-thread.h @@ -26,15 +26,16 @@ #include #include #include +#include struct notification_thread_handle { /* * Queue of struct notification command. - * event_fd must be WRITE(2) to signal that a new command + * event_pipe must be WRITE(2) to signal that a new command * has been enqueued. */ struct { - int event_fd; + struct lttng_pipe *event_pipe; struct cds_list_head list; pthread_mutex_t lock; } cmd_queue; @@ -47,6 +48,10 @@ struct notification_thread_handle { int ust64_consumer; int kernel_consumer; } channel_monitoring_pipes; + /* + * To inform the rotation thread we are ready. + */ + sem_t *notification_thread_ready; }; /** @@ -88,8 +93,14 @@ struct notification_thread_handle { * associates a channel_key to a struct channel_info. The hash table * holds the ownership of the struct channel_info. * + * - sessions_ht: + * associates a session_name (hash) to a struct session_info. The + * hash table holds no ownership of the struct session_info; + * the session_info structure is owned by the session's various + * channels through their struct channel_info (ref-counting is used). + * * - triggers_ht: - * associated a condition to a struct lttng_trigger_ht_element. + * associates a condition to a struct lttng_trigger_ht_element. * The hash table holds the ownership of the * lttng_trigger_ht_elements along with the triggers themselves. * @@ -110,7 +121,7 @@ struct notification_thread_handle { * 1) Creation of a tracing channel * - notification_trigger_clients_ht is traversed to identify * triggers which apply to this new channel, - * - triggers identified are added to the channel_triggers_ht. + * - triggers identified are added to the channel_triggers_ht. * - add channel to channels_ht * * 2) Destruction of a tracing channel @@ -127,6 +138,8 @@ struct notification_thread_handle { * notification_trigger_clients_ht, * - add trigger to channel_triggers_ht (if applicable), * - add trigger to triggers_ht + * - evaluate the trigger's condition right away to react if that condition + * is true from the beginning. * * 4) Unregistration of a trigger * - if the trigger's action is of type "notify", @@ -153,6 +166,8 @@ struct notification_thread_handle { * - Add the condition to the client's list of subscribed conditions, * - Look-up notification_trigger_clients_ht and add the client to * list of clients. + * - Evaluate the condition for the client that subscribed if the trigger + * was already registered. * * 9) Unsubscription of a client to a condition's notifications * - Remove the condition from the client's list of subscribed conditions, @@ -167,6 +182,7 @@ struct notification_thread_state { struct cds_lfht *channel_state_ht; struct cds_lfht *notification_trigger_clients_ht; struct cds_lfht *channels_ht; + struct cds_lfht *sessions_ht; struct cds_lfht *triggers_ht; }; @@ -174,7 +190,8 @@ struct notification_thread_state { struct notification_thread_handle *notification_thread_handle_create( struct lttng_pipe *ust32_channel_monitor_pipe, struct lttng_pipe *ust64_channel_monitor_pipe, - struct lttng_pipe *kernel_channel_monitor_pipe); + struct lttng_pipe *kernel_channel_monitor_pipe, + sem_t *notification_thread_ready); void notification_thread_handle_destroy( struct notification_thread_handle *handle);