mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 20:06:18 +01:00
Merge branch 'optimise_gatomicrefcount' into 'master'
grefcount: Optimise g_atomic_ref_count_inc Closes #1583 See merge request GNOME/glib!2086
This commit is contained in:
commit
ea4721422f
@ -235,16 +235,14 @@ void
|
|||||||
void
|
void
|
||||||
(g_atomic_ref_count_inc) (gatomicrefcount *arc)
|
(g_atomic_ref_count_inc) (gatomicrefcount *arc)
|
||||||
{
|
{
|
||||||
|
gint old_value;
|
||||||
|
|
||||||
g_return_if_fail (arc != NULL);
|
g_return_if_fail (arc != NULL);
|
||||||
g_return_if_fail (g_atomic_int_get (arc) > 0);
|
old_value = g_atomic_int_add (arc, 1);
|
||||||
|
g_return_if_fail (old_value > 0);
|
||||||
|
|
||||||
if (g_atomic_int_get (arc) == G_MAXINT)
|
if (old_value == G_MAXINT)
|
||||||
{
|
g_critical ("Reference count has reached saturation");
|
||||||
g_critical ("Reference count has reached saturation");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_atomic_int_inc (arc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user