mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 20:22:11 +01:00
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
This commit is contained in:
parent
fab561f8d0
commit
a6ce0e742a
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user