From: Jérémie Galarneau Date: Wed, 7 Apr 2021 16:50:51 +0000 (-0400) Subject: Docs: sessiond: document the rationale for the iteration on triggers list X-Git-Tag: v2.13.0-rc1~153 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=57644a7fce9870621d2868036a308dc5affd59aa Docs: sessiond: document the rationale for the iteration on triggers list Document the reason why an iteration is performed on the list of triggers of a "client list" when a client subscribes to a condition. Signed-off-by: Jérémie Galarneau Change-Id: I7d1c15016064ff2f6498c925f4933450fc7da30b --- diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index d3b6cd855..4623ef38c 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -1139,9 +1139,10 @@ int notification_thread_client_subscribe(struct notification_client *client, * at this point so that conditions that are already TRUE result * in a notification being sent out. * - * The client_list's trigger is used without locking the list itself. - * This is correct since the list doesn't own the trigger and the - * object is immutable. + * Note the iteration on all triggers which share an identical + * `condition` than the one to which the client is registering. This is + * done to ensure that the client receives a distinct notification for + * all triggers that have a `notify` action that have this condition. */ pthread_mutex_lock(&client_list->lock); cds_list_for_each_entry(trigger_ht_element, diff --git a/src/bin/lttng-sessiond/notification-thread-internal.h b/src/bin/lttng-sessiond/notification-thread-internal.h index fe53a5161..e835bd6af 100644 --- a/src/bin/lttng-sessiond/notification-thread-internal.h +++ b/src/bin/lttng-sessiond/notification-thread-internal.h @@ -114,6 +114,7 @@ struct notification_client_list { pthread_mutex_t lock; struct urcu_ref ref; struct lttng_condition *condition; + /* List of triggers that have an identical condition than `condition`. */ struct cds_list_head triggers_list; struct cds_list_head clients_list; /* Weak reference to container. */