blob: b8ed99ce15db7927676b6939f650895ebacb164d [file] [log] [blame]
Andrew Geissler95ac1b82021-03-31 14:34:31 -05001From 8a112c3c6e5fe6838ee29eec7caa62ba32d9bc40 Mon Sep 17 00:00:00 2001
2From: Philip Withnall <pwithnall@endlessos.org>
3Date: Wed, 11 Nov 2020 19:22:49 +0000
4Subject: [PATCH 21/29] tests: Drop unnecessary volatile qualifiers from tests
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9These variables were already (correctly) accessed atomically. The
10`volatile` qualifier doesnt help with that.
11
12Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
13
14Helps: #600
15Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719]
16---
17 gobject/tests/qdata.c | 2 +-
18 gobject/tests/threadtests.c | 4 ++--
19 2 files changed, 3 insertions(+), 3 deletions(-)
20
21diff --git a/gobject/tests/qdata.c b/gobject/tests/qdata.c
22index 528bdc68e..7d46efb15 100644
23--- a/gobject/tests/qdata.c
24+++ b/gobject/tests/qdata.c
25@@ -17,7 +17,7 @@ gboolean fail;
26 #define ROUNDS 10000
27
28 GObject *object;
29-volatile gint bucket[THREADS];
30+gint bucket[THREADS]; /* accessed from multiple threads, but should never be contested due to the sequence of thread operations */
31
32 static gpointer
33 thread_func (gpointer data)
34diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c
35index e341a9d67..b6f9e17fa 100644
36--- a/gobject/tests/threadtests.c
37+++ b/gobject/tests/threadtests.c
38@@ -27,8 +27,8 @@
39 #include <glib.h>
40 #include <glib-object.h>
41
42-static volatile int mtsafe_call_counter = 0; /* multi thread safe call counter */
43-static int unsafe_call_counter = 0; /* single-threaded call counter */
44+static int mtsafe_call_counter = 0; /* multi thread safe call counter, must be accessed atomically */
45+static int unsafe_call_counter = 0; /* single-threaded call counter */
46 static GCond sync_cond;
47 static GMutex sync_mutex;
48
49--
502.30.1
51