[lttng-dev] [PATCH 7/7] Experiment: Add explicit memory barrier in free_completion()

Ondřej Surý ondrej at sury.org
Fri Mar 17 17:37:55 EDT 2023


FIXME: This is experiment that adds explicit memory barrier in the
free_completion in the workqueue.c, so ThreadSanitizer knows it's ok to
free the resources.

Signed-off-by: Ondřej Surý <ondrej at sury.org>
---
 src/workqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/workqueue.c b/src/workqueue.c
index 1039d72..f21907f 100644
--- a/src/workqueue.c
+++ b/src/workqueue.c
@@ -377,6 +377,7 @@ void free_completion(struct urcu_ref *ref)
 	struct urcu_workqueue_completion *completion;
 
 	completion = caa_container_of(ref, struct urcu_workqueue_completion, ref);
+	assert(!urcu_ref_get_unless_zero(&completion->ref));
 	free(completion);
 }
 
-- 
2.39.2



More information about the lttng-dev mailing list