mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
carry out all dtalist pointer accesses atomically, some missing cases
Tue Jan 31 16:45:03 2006 Tim Janik <timj@imendio.com> * glib/gdataset.c: carry out all dtalist pointer accesses atomically, some missing cases where pointed out by Sebastian Wilhelmi.
This commit is contained in:
parent
7162fbbbfd
commit
20887fa148
@ -1,3 +1,8 @@
|
||||
Tue Jan 31 16:45:03 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: carry out all dtalist pointer accesses atomically,
|
||||
some missing cases where pointed out by Sebastian Wilhelmi.
|
||||
|
||||
Tue Jan 31 12:33:48 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* configure.in: generate build/win32/vs8/Makefile, to fix build breakage.
|
||||
|
@ -1,3 +1,8 @@
|
||||
Tue Jan 31 16:45:03 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: carry out all dtalist pointer accesses atomically,
|
||||
some missing cases where pointed out by Sebastian Wilhelmi.
|
||||
|
||||
Tue Jan 31 12:33:48 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* configure.in: generate build/win32/vs8/Makefile, to fix build breakage.
|
||||
|
@ -1,3 +1,8 @@
|
||||
Tue Jan 31 16:45:03 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/gdataset.c: carry out all dtalist pointer accesses atomically,
|
||||
some missing cases where pointed out by Sebastian Wilhelmi.
|
||||
|
||||
Tue Jan 31 12:33:48 2006 Tim Janik <timj@imendio.com>
|
||||
|
||||
* configure.in: generate build/win32/vs8/Makefile, to fix build breakage.
|
||||
|
@ -42,14 +42,17 @@
|
||||
/* --- defines --- */
|
||||
#define G_QUARK_BLOCK_SIZE (512)
|
||||
|
||||
/* datalist pointer modifications have to be done with the g_dataset_global mutex held */
|
||||
/* datalist pointer accesses vae to be carried out atomically */
|
||||
#define G_DATALIST_GET_POINTER(datalist) \
|
||||
((GData*) ((gsize) *(datalist) & ~(gsize) G_DATALIST_FLAGS_MASK))
|
||||
#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \
|
||||
*(datalist) = (GData*) (G_DATALIST_GET_FLAGS (datalist) | \
|
||||
(gsize) pointer); \
|
||||
} G_STMT_END
|
||||
((GData*) ((gsize) g_atomic_pointer_get ((gpointer*) datalist) & ~(gsize) G_DATALIST_FLAGS_MASK))
|
||||
|
||||
#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \
|
||||
gpointer _oldv, _newv; \
|
||||
do { \
|
||||
_oldv = g_atomic_pointer_get (datalist); \
|
||||
_newv = (gpointer) (((gsize) _oldv & G_DATALIST_FLAGS_MASK) | (gsize) pointer); \
|
||||
} while (!g_atomic_pointer_compare_and_exchange ((void**) datalist, _oldv, _newv)); \
|
||||
} G_STMT_END
|
||||
|
||||
/* --- structures --- */
|
||||
typedef struct _GDataset GDataset;
|
||||
@ -502,7 +505,7 @@ g_datalist_init (GData **datalist)
|
||||
{
|
||||
g_return_if_fail (datalist != NULL);
|
||||
|
||||
*datalist = NULL;
|
||||
g_atomic_pointer_set ((gpointer*) datalist, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ G_BEGIN_DECLS
|
||||
* barriers to take effect without acquiring the global dataset mutex.
|
||||
*/
|
||||
#define G_DATALIST_GET_FLAGS(datalist) \
|
||||
((gsize) g_atomic_pointer_get ((gpointer *)(datalist)) & G_DATALIST_FLAGS_MASK)
|
||||
((gsize) g_atomic_pointer_get ((gpointer*) datalist) & G_DATALIST_FLAGS_MASK)
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user