summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <pwithnall@endlessos.org>2020-11-11 19:22:49 +0000
committerPhilip Withnall <pwithnall@endlessos.org>2020-11-20 14:40:19 +0000
commit8a112c3c6e5fe6838ee29eec7caa62ba32d9bc40 (patch)
treeb5511e954fec4fc975dad8d931966c7e56ee6c8e
parent334f6953364680ddc6c0d3da13fda1d92bf5379d (diff)
downloadglib-8a112c3c6e5fe6838ee29eec7caa62ba32d9bc40.tar.gz
tests: Drop unnecessary volatile qualifiers from tests
These variables were already (correctly) accessed atomically. The `volatile` qualifier doesn’t help with that. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #600
-rw-r--r--gobject/tests/qdata.c2
-rw-r--r--gobject/tests/threadtests.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/gobject/tests/qdata.c b/gobject/tests/qdata.c
index 528bdc68e..7d46efb15 100644
--- a/gobject/tests/qdata.c
+++ b/gobject/tests/qdata.c
@@ -17,7 +17,7 @@ gboolean fail;
#define ROUNDS 10000
GObject *object;
-volatile gint bucket[THREADS];
+gint bucket[THREADS]; /* accessed from multiple threads, but should never be contested due to the sequence of thread operations */
static gpointer
thread_func (gpointer data)
diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c
index e341a9d67..b6f9e17fa 100644
--- a/gobject/tests/threadtests.c
+++ b/gobject/tests/threadtests.c
@@ -27,8 +27,8 @@
#include <glib.h>
#include <glib-object.h>
-static volatile int mtsafe_call_counter = 0; /* multi thread safe call counter */
-static int unsafe_call_counter = 0; /* single-threaded call counter */
+static int mtsafe_call_counter = 0; /* multi thread safe call counter, must be accessed atomically */
+static int unsafe_call_counter = 0; /* single-threaded call counter */
static GCond sync_cond;
static GMutex sync_mutex;