From 57644a7fce9870621d2868036a308dc5affd59aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 7 Apr 2021 12:50:51 -0400 Subject: [PATCH] Docs: sessiond: document the rationale for the iteration on triggers list MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-sessiond/notification-thread-events.c | 7 ++++--- src/bin/lttng-sessiond/notification-thread-internal.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) 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. */ -- 2.34.1