mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 20:06:18 +01:00
Merge branch 'optimise_g_atomic_ref_count_dec' into 'master'
grefcount: Optimise g_atomic_ref_count_dec See merge request GNOME/glib!2098
This commit is contained in:
commit
4cd1a1c03d
@ -262,10 +262,13 @@ void
|
|||||||
gboolean
|
gboolean
|
||||||
(g_atomic_ref_count_dec) (gatomicrefcount *arc)
|
(g_atomic_ref_count_dec) (gatomicrefcount *arc)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (arc != NULL, FALSE);
|
gint old_value;
|
||||||
g_return_val_if_fail (g_atomic_int_get (arc) > 0, FALSE);
|
|
||||||
|
|
||||||
return g_atomic_int_dec_and_test (arc);
|
g_return_val_if_fail (arc != NULL, FALSE);
|
||||||
|
old_value = g_atomic_int_add (arc, -1);
|
||||||
|
g_return_val_if_fail (old_value > 0, FALSE);
|
||||||
|
|
||||||
|
return old_value == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user