mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-27 18:10:03 +01:00
placed a comment about not changing CArray until we have
Sun Mar 3 04:11:58 2002 Tim Janik <timj@gtk.org> * gobject.c: placed a comment about not changing CArray until we have g_object_list_watched_closures(). * gparam.h (struct _GParamSpecClass): added padding. * gobjectnotifyqueue.c (struct _GObjectNotifyQueue): abuse g_list_alloc() to allocate GObjectNotifyQueue to et rid of locking issues.
This commit is contained in:
parent
c2d49b8f7e
commit
d7dd9aefd8
@ -1,3 +1,14 @@
|
|||||||
|
Sun Mar 3 04:11:58 2002 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* gobject.c: placed a comment about not changing CArray until we have
|
||||||
|
g_object_list_watched_closures().
|
||||||
|
|
||||||
|
* gparam.h (struct _GParamSpecClass): added padding.
|
||||||
|
|
||||||
|
* gobjectnotifyqueue.c (struct _GObjectNotifyQueue): abuse
|
||||||
|
g_list_alloc() to allocate GObjectNotifyQueue to et rid
|
||||||
|
of locking issues.
|
||||||
|
|
||||||
Tue Feb 26 10:51:00 2002 Owen Taylor <otaylor@redhat.com>
|
Tue Feb 26 10:51:00 2002 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* Makefile.am (testgobject_LDADD): Rename testgruntime
|
* Makefile.am (testgobject_LDADD): Rename testgruntime
|
||||||
|
@ -233,7 +233,9 @@ g_object_notify_dispatcher (GObject *object,
|
|||||||
static void
|
static void
|
||||||
g_object_do_class_init (GObjectClass *class)
|
g_object_do_class_init (GObjectClass *class)
|
||||||
{
|
{
|
||||||
|
/* read the comment about typedef struct CArray; on why not to change this quark */
|
||||||
quark_closure_array = g_quark_from_static_string ("GObject-closure-array");
|
quark_closure_array = g_quark_from_static_string ("GObject-closure-array");
|
||||||
|
|
||||||
quark_weak_refs = g_quark_from_static_string ("GObject-weak-references");
|
quark_weak_refs = g_quark_from_static_string ("GObject-weak-references");
|
||||||
pspec_pool = g_param_spec_pool_new (TRUE);
|
pspec_pool = g_param_spec_pool_new (TRUE);
|
||||||
property_notify_context.quark_notify_queue = g_quark_from_static_string ("GObject-notify-queue");
|
property_notify_context.quark_notify_queue = g_quark_from_static_string ("GObject-notify-queue");
|
||||||
@ -1593,6 +1595,24 @@ typedef struct {
|
|||||||
guint n_closures;
|
guint n_closures;
|
||||||
GClosure *closures[1]; /* flexible array */
|
GClosure *closures[1]; /* flexible array */
|
||||||
} CArray;
|
} CArray;
|
||||||
|
/* don't change this structure without supplying an accessor for
|
||||||
|
* watched closures, e.g.:
|
||||||
|
* GSList* g_object_list_watched_closures (GObject *object)
|
||||||
|
* {
|
||||||
|
* CArray *carray;
|
||||||
|
* g_return_val_if_fail (G_IS_OBJECT (object), NULL);
|
||||||
|
* carray = g_object_get_data (object, "GObject-closure-array");
|
||||||
|
* if (carray)
|
||||||
|
* {
|
||||||
|
* GSList *slist = NULL;
|
||||||
|
* guint i;
|
||||||
|
* for (i = 0; i < carray->n_closures; i++)
|
||||||
|
* slist = g_slist_prepend (slist, carray->closures[i]);
|
||||||
|
* return slist;
|
||||||
|
* }
|
||||||
|
* return NULL;
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
object_remove_closure (gpointer data,
|
object_remove_closure (gpointer data,
|
||||||
|
@ -38,14 +38,17 @@ struct _GObjectNotifyContext
|
|||||||
{
|
{
|
||||||
GQuark quark_notify_queue;
|
GQuark quark_notify_queue;
|
||||||
GObjectNotifyQueueDispatcher dispatcher;
|
GObjectNotifyQueueDispatcher dispatcher;
|
||||||
GTrashStack *nqueue_trash;
|
GTrashStack *_nqueue_trash; /* unused */
|
||||||
};
|
};
|
||||||
struct _GObjectNotifyQueue
|
struct _GObjectNotifyQueue
|
||||||
{
|
{
|
||||||
GObjectNotifyContext *context;
|
GObjectNotifyContext *context;
|
||||||
GSList *pspecs;
|
GSList *pspecs;
|
||||||
guint n_pspecs;
|
guint16 n_pspecs;
|
||||||
guint freeze_count;
|
guint16 freeze_count;
|
||||||
|
/* currently, this structure abuses the GList allocation chain and thus
|
||||||
|
* must be <= sizeof (GList)
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +59,7 @@ g_object_notify_queue_free (gpointer data)
|
|||||||
GObjectNotifyQueue *nqueue = data;
|
GObjectNotifyQueue *nqueue = data;
|
||||||
|
|
||||||
g_slist_free (nqueue->pspecs);
|
g_slist_free (nqueue->pspecs);
|
||||||
g_trash_stack_push (&nqueue->context->nqueue_trash, nqueue);
|
g_list_free_1 ((void*) nqueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GObjectNotifyQueue*
|
static inline GObjectNotifyQueue*
|
||||||
@ -68,20 +71,14 @@ g_object_notify_queue_freeze (GObject *object,
|
|||||||
nqueue = g_datalist_id_get_data (&object->qdata, context->quark_notify_queue);
|
nqueue = g_datalist_id_get_data (&object->qdata, context->quark_notify_queue);
|
||||||
if (!nqueue)
|
if (!nqueue)
|
||||||
{
|
{
|
||||||
nqueue = g_trash_stack_pop (&context->nqueue_trash);
|
nqueue = (void*) g_list_alloc ();
|
||||||
if (!nqueue)
|
|
||||||
{
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
nqueue = g_new (GObjectNotifyQueue, 16);
|
|
||||||
for (i = 0; i < 15; i++)
|
|
||||||
g_trash_stack_push (&context->nqueue_trash, nqueue++);
|
|
||||||
}
|
|
||||||
memset (nqueue, 0, sizeof (*nqueue));
|
memset (nqueue, 0, sizeof (*nqueue));
|
||||||
nqueue->context = context;
|
nqueue->context = context;
|
||||||
g_datalist_id_set_data_full (&object->qdata, context->quark_notify_queue,
|
g_datalist_id_set_data_full (&object->qdata, context->quark_notify_queue,
|
||||||
nqueue, g_object_notify_queue_free);
|
nqueue, g_object_notify_queue_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_return_val_if_fail (nqueue->freeze_count < 65535, nqueue);
|
||||||
nqueue->freeze_count++;
|
nqueue->freeze_count++;
|
||||||
|
|
||||||
return nqueue;
|
return nqueue;
|
||||||
@ -145,6 +142,8 @@ g_object_notify_queue_add (GObject *object,
|
|||||||
{
|
{
|
||||||
if (pspec->flags & G_PARAM_READABLE)
|
if (pspec->flags & G_PARAM_READABLE)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (nqueue->n_pspecs < 65535);
|
||||||
|
|
||||||
/* we do the deduping in _thaw */
|
/* we do the deduping in _thaw */
|
||||||
nqueue->pspecs = g_slist_prepend (nqueue->pspecs, pspec);
|
nqueue->pspecs = g_slist_prepend (nqueue->pspecs, pspec);
|
||||||
nqueue->n_pspecs++;
|
nqueue->n_pspecs++;
|
||||||
|
@ -98,6 +98,7 @@ struct _GParamSpecClass
|
|||||||
gint (*values_cmp) (GParamSpec *pspec,
|
gint (*values_cmp) (GParamSpec *pspec,
|
||||||
const GValue *value1,
|
const GValue *value1,
|
||||||
const GValue *value2);
|
const GValue *value2);
|
||||||
|
gpointer dummy[4];
|
||||||
};
|
};
|
||||||
struct _GParameter /* auxillary structure for _setv() variants */
|
struct _GParameter /* auxillary structure for _setv() variants */
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user