mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
gobject: add g_object_notify_queue_create_queue_frozen() helper
This will be used next, and is a separate commit to do a trivial thing first.
This commit is contained in:
parent
9bee14ef3e
commit
a2b467624b
@ -213,6 +213,23 @@ g_object_notify_queue_free (gpointer data)
|
|||||||
g_slice_free (GObjectNotifyQueue, nqueue);
|
g_slice_free (GObjectNotifyQueue, nqueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GObjectNotifyQueue *
|
||||||
|
g_object_notify_queue_create_queue_frozen (GObject *object)
|
||||||
|
{
|
||||||
|
GObjectNotifyQueue *nqueue;
|
||||||
|
|
||||||
|
nqueue = g_slice_new0 (GObjectNotifyQueue);
|
||||||
|
|
||||||
|
*nqueue = (GObjectNotifyQueue){
|
||||||
|
.freeze_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
g_datalist_id_set_data_full (&object->qdata, quark_notify_queue,
|
||||||
|
nqueue, g_object_notify_queue_free);
|
||||||
|
|
||||||
|
return nqueue;
|
||||||
|
}
|
||||||
|
|
||||||
static GObjectNotifyQueue*
|
static GObjectNotifyQueue*
|
||||||
g_object_notify_queue_freeze (GObject *object,
|
g_object_notify_queue_freeze (GObject *object,
|
||||||
gboolean conditional)
|
gboolean conditional)
|
||||||
@ -229,9 +246,8 @@ g_object_notify_queue_freeze (GObject *object,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nqueue = g_slice_new0 (GObjectNotifyQueue);
|
nqueue = g_object_notify_queue_create_queue_frozen (object);
|
||||||
g_datalist_id_set_data_full (&object->qdata, quark_notify_queue,
|
goto out;
|
||||||
nqueue, g_object_notify_queue_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nqueue->freeze_count >= 65535)
|
if (nqueue->freeze_count >= 65535)
|
||||||
@ -242,6 +258,7 @@ g_object_notify_queue_freeze (GObject *object,
|
|||||||
else
|
else
|
||||||
nqueue->freeze_count++;
|
nqueue->freeze_count++;
|
||||||
|
|
||||||
|
out:
|
||||||
G_UNLOCK(notify_lock);
|
G_UNLOCK(notify_lock);
|
||||||
|
|
||||||
return nqueue;
|
return nqueue;
|
||||||
|
Loading…
Reference in New Issue
Block a user