diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2020-11-11 18:14:29 +0000 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2020-11-20 14:40:19 +0000 |
commit | a6ce0e742a5c75c53a7c702ebb1af1084065160a (patch) | |
tree | dd86f802af372cf27239459e430dd37bcfb57e42 | |
parent | fab561f8d05794329184cd81f9ab9d9d77dcc22a (diff) | |
download | glib-a6ce0e742a5c75c53a7c702ebb1af1084065160a.tar.gz |
tests: Fix non-atomic access to a shared variable
And drop the `volatile` qualifier from the variable, as that doesn’t
help with thread safety.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #600
-rw-r--r-- | glib/tests/642026.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/glib/tests/642026.c b/glib/tests/642026.c index ef54f14bb..26ab2ed06 100644 --- a/glib/tests/642026.c +++ b/glib/tests/642026.c @@ -25,7 +25,7 @@ static GMutex *mutex; static GCond *cond; static guint i; -static volatile gint freed = 0; +static gint freed = 0; /* (atomic) */ static void notify (gpointer p) @@ -63,7 +63,7 @@ testcase (void) GThread *t1; g_static_private_init (&sp); - freed = 0; + g_atomic_int_set (&freed, 0); t1 = g_thread_create (thread_func, NULL, TRUE, NULL); g_assert (t1 != NULL); |