mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-31 04:43:06 +02:00
gobject: Use a while instead of goto to repeat atomic increment
We can use a cleaner solution now that we do not require to init the same value multiple times in the same way.
This commit is contained in:
parent
c95bf0514c
commit
a89048c4f1
@ -3871,8 +3871,8 @@ g_object_unref (gpointer _object)
|
|||||||
|
|
||||||
/* may have been re-referenced meanwhile */
|
/* may have been re-referenced meanwhile */
|
||||||
old_ref = g_atomic_int_get ((int *)&object->ref_count);
|
old_ref = g_atomic_int_get ((int *)&object->ref_count);
|
||||||
retry_atomic_decrement2:
|
|
||||||
if (old_ref > 1)
|
while (old_ref > 1)
|
||||||
{
|
{
|
||||||
/* valid if last 2 refs are owned by this call to unref and the toggle_ref */
|
/* valid if last 2 refs are owned by this call to unref and the toggle_ref */
|
||||||
gboolean has_toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
|
gboolean has_toggle_ref = OBJECT_HAS_TOGGLE_REF (object);
|
||||||
@ -3880,7 +3880,7 @@ g_object_unref (gpointer _object)
|
|||||||
if (!g_atomic_int_compare_and_exchange_full ((int *)&object->ref_count,
|
if (!g_atomic_int_compare_and_exchange_full ((int *)&object->ref_count,
|
||||||
old_ref, old_ref - 1,
|
old_ref, old_ref - 1,
|
||||||
&old_ref))
|
&old_ref))
|
||||||
goto retry_atomic_decrement2;
|
continue;
|
||||||
|
|
||||||
/* emit all notifications that have been queued during dispose() */
|
/* emit all notifications that have been queued during dispose() */
|
||||||
g_object_notify_queue_thaw (object, nqueue);
|
g_object_notify_queue_thaw (object, nqueue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user