mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
gthread: Use atomic pointer exchange to check value set on g_init_leave
This commit is contained in:
parent
2c322f2a65
commit
00f3f0d407
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user