From 14da9d459ceb37ecb2ee4e6003cabf2fff319f7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 19 Feb 2025 05:34:13 +0100 Subject: [PATCH] gio/tests/cancellable: Actually init atomic values with atomic functions This is to make thread sanitizer happy, even those aren't really issues. --- gio/tests/cancellable.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gio/tests/cancellable.c b/gio/tests/cancellable.c index bbe53e4a2..f8ff69cb5 100644 --- a/gio/tests/cancellable.c +++ b/gio/tests/cancellable.c @@ -755,8 +755,11 @@ repeatedly_connecting_thread (gpointer data) for (guint i = 0; i < iterations; ++i) { - gboolean callback_called = FALSE; /* (atomic) */ + gboolean callback_called; /* (atomic) */ gboolean called; + + g_atomic_int_set (&callback_called, FALSE); + gulong id = g_cancellable_connect (cancellable, G_CALLBACK (on_racy_cancellable_cancelled), &callback_called, NULL); @@ -780,13 +783,14 @@ test_cancellable_cancel_reset_connect_races (void) GThread *resetting_thread = NULL; GThread *cancelling_thread = NULL; GThread *connecting_thread = NULL; - gboolean callback_called = FALSE; /* (atomic) */ + gboolean callback_called; /* (atomic) */ g_test_summary ("Tests threads racing for cancelling, connecting and disconnecting " " and resetting a GCancellable"); cancellable = g_cancellable_new (); + g_atomic_int_set (&callback_called, FALSE); g_cancellable_connect (cancellable, G_CALLBACK (on_racy_cancellable_cancelled), &callback_called, NULL); g_assert_false (g_atomic_int_get (&callback_called));