mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
access datalist flags via atomic pointer access funcitons, instead of
Wed Nov 23 17:34:01 2005 Tim Janik <timj@imendio.com> * glib/gdataset.c: access datalist flags via atomic pointer access funcitons, instead of acquiring the dataset lock. this is faster and also matches the atomic pointer readouts in gdatalistprivate.h and direct pointer modifications required by gobject.c.
This commit is contained in:
parent
6e5f465924
commit
2027d87b5b
@ -1,3 +1,10 @@
|
||||
Wed Nov 23 17:34:01 2005 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: access datalist flags via atomic pointer access
|
||||
funcitons, instead of acquiring the dataset lock. this is faster and
|
||||
also matches the atomic pointer readouts in gdatalistprivate.h and
|
||||
direct pointer modifications required by gobject.c.
|
||||
|
||||
Wed Nov 23 13:35:31 2005 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/gdataset.c: streamlined initialization code somewhat,
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 23 17:34:01 2005 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: access datalist flags via atomic pointer access
|
||||
funcitons, instead of acquiring the dataset lock. this is faster and
|
||||
also matches the atomic pointer readouts in gdatalistprivate.h and
|
||||
direct pointer modifications required by gobject.c.
|
||||
|
||||
Wed Nov 23 13:35:31 2005 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/gdataset.c: streamlined initialization code somewhat,
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Nov 23 17:34:01 2005 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: access datalist flags via atomic pointer access
|
||||
funcitons, instead of acquiring the dataset lock. this is faster and
|
||||
also matches the atomic pointer readouts in gdatalistprivate.h and
|
||||
direct pointer modifications required by gobject.c.
|
||||
|
||||
Wed Nov 23 13:35:31 2005 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib/gdataset.c: streamlined initialization code somewhat,
|
||||
|
@ -525,12 +525,16 @@ void
|
||||
g_datalist_set_flags (GData **datalist,
|
||||
guint flags)
|
||||
{
|
||||
gpointer oldvalue;
|
||||
g_return_if_fail (datalist != NULL);
|
||||
g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0);
|
||||
|
||||
G_LOCK (g_dataset_global);
|
||||
*datalist = (GData*) (flags | (gsize) *datalist);
|
||||
G_UNLOCK (g_dataset_global);
|
||||
|
||||
do
|
||||
{
|
||||
oldvalue = g_atomic_pointer_get (datalist);
|
||||
}
|
||||
while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, oldvalue,
|
||||
(gpointer) ((gsize) oldvalue | flags)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -548,12 +552,16 @@ void
|
||||
g_datalist_unset_flags (GData **datalist,
|
||||
guint flags)
|
||||
{
|
||||
gpointer oldvalue;
|
||||
g_return_if_fail (datalist != NULL);
|
||||
g_return_if_fail ((flags & ~G_DATALIST_FLAGS_MASK) == 0);
|
||||
|
||||
G_LOCK (g_dataset_global);
|
||||
*datalist = (GData*) (~(gsize) flags & (gsize) *datalist);
|
||||
G_UNLOCK (g_dataset_global);
|
||||
|
||||
do
|
||||
{
|
||||
oldvalue = g_atomic_pointer_get (datalist);
|
||||
}
|
||||
while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, oldvalue,
|
||||
(gpointer) ((gsize) oldvalue & ~(gsize) flags)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -569,7 +577,7 @@ guint
|
||||
g_datalist_get_flags (GData **datalist)
|
||||
{
|
||||
g_return_val_if_fail (datalist != NULL, 0);
|
||||
|
||||
|
||||
return G_DATALIST_GET_FLAGS (datalist); /* atomic macro */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user