gthread: Use atomic pointer exchange to check value set on g_init_leave

This commit is contained in:
Marco Trevisan (Treviño) 2022-06-21 05:02:30 +02:00
parent 2c322f2a65
commit 00f3f0d407

View File

@ -741,11 +741,13 @@ void
gsize result)
{
gsize *value_location = (gsize *) location;
gsize old_value;
g_return_if_fail (g_atomic_pointer_get (value_location) == 0);
g_return_if_fail (result != 0);
g_atomic_pointer_set (value_location, result);
old_value = (gsize) g_atomic_pointer_exchange (value_location, result);
g_return_if_fail (old_value == 0);
g_mutex_lock (&g_once_mutex);
g_return_if_fail (g_once_init_list != NULL);
g_once_init_list = g_slist_remove (g_once_init_list, (void*) value_location);