mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Merge branch 'gobject-speedup10' into 'main'
gobject: Avoid redundant atomics See merge request GNOME/glib!2724
This commit is contained in:
commit
3076c60e9c
@ -319,23 +319,23 @@ g_object_notify_queue_thaw (GObject *object,
|
||||
GSList *slist;
|
||||
guint n_pspecs = 0;
|
||||
|
||||
g_return_if_fail (g_atomic_int_get(&object->ref_count) > 0);
|
||||
|
||||
G_LOCK(notify_lock);
|
||||
|
||||
/* Just make sure we never get into some nasty race condition */
|
||||
if (G_UNLIKELY(nqueue->freeze_count == 0)) {
|
||||
G_UNLOCK(notify_lock);
|
||||
g_warning ("%s: property-changed notification for %s(%p) is not frozen",
|
||||
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
|
||||
return;
|
||||
}
|
||||
if (G_UNLIKELY (nqueue->freeze_count == 0))
|
||||
{
|
||||
G_UNLOCK (notify_lock);
|
||||
g_warning ("%s: property-changed notification for %s(%p) is not frozen",
|
||||
G_STRFUNC, G_OBJECT_TYPE_NAME (object), object);
|
||||
return;
|
||||
}
|
||||
|
||||
nqueue->freeze_count--;
|
||||
if (nqueue->freeze_count) {
|
||||
G_UNLOCK(notify_lock);
|
||||
return;
|
||||
}
|
||||
if (nqueue->freeze_count)
|
||||
{
|
||||
G_UNLOCK (notify_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
pspecs = nqueue->n_pspecs > 16 ? free_me = g_new (GParamSpec*, nqueue->n_pspecs) : pspecs_mem;
|
||||
|
||||
@ -1394,8 +1394,6 @@ g_object_notify (GObject *object,
|
||||
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
g_return_if_fail (property_name != NULL);
|
||||
if (g_atomic_int_get (&object->ref_count) == 0)
|
||||
return;
|
||||
|
||||
/* We don't need to get the redirect target
|
||||
* (by, e.g. calling g_object_class_find_property())
|
||||
@ -1468,9 +1466,6 @@ g_object_notify_by_pspec (GObject *object,
|
||||
g_return_if_fail (G_IS_OBJECT (object));
|
||||
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
|
||||
|
||||
if (g_atomic_int_get (&object->ref_count) == 0)
|
||||
return;
|
||||
|
||||
g_object_notify_by_spec_internal (object, pspec);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user