mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
gdataset: use g_pointer_bit_lock_and_get() for g_datalist_lock_and_get()
This commit is contained in:
parent
5609370de9
commit
f6b24a0a20
@ -67,9 +67,12 @@
|
|||||||
|
|
||||||
#define G_DATALIST_FLAGS_MASK_INTERNAL 0x7
|
#define G_DATALIST_FLAGS_MASK_INTERNAL 0x7
|
||||||
|
|
||||||
|
#define G_DATALIST_CLEAN_POINTER(ptr) \
|
||||||
|
((GData *) ((gpointer) (((guintptr) (ptr)) & ~((guintptr) G_DATALIST_FLAGS_MASK_INTERNAL))))
|
||||||
|
|
||||||
/* datalist pointer accesses have to be carried out atomically */
|
/* datalist pointer accesses have to be carried out atomically */
|
||||||
#define G_DATALIST_GET_POINTER(datalist) \
|
#define G_DATALIST_GET_POINTER(datalist) \
|
||||||
((GData *) ((gpointer) ((guintptr) g_atomic_pointer_get (datalist) & ~((guintptr) G_DATALIST_FLAGS_MASK_INTERNAL))))
|
G_DATALIST_CLEAN_POINTER (g_atomic_pointer_get (datalist))
|
||||||
|
|
||||||
#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \
|
#define G_DATALIST_SET_POINTER(datalist, pointer) G_STMT_START { \
|
||||||
gpointer _oldv = g_atomic_pointer_get (datalist); \
|
gpointer _oldv = g_atomic_pointer_get (datalist); \
|
||||||
@ -136,8 +139,10 @@ static GDataset *g_dataset_cached = NULL; /* should this be
|
|||||||
G_ALWAYS_INLINE static inline GData *
|
G_ALWAYS_INLINE static inline GData *
|
||||||
g_datalist_lock_and_get (GData **datalist)
|
g_datalist_lock_and_get (GData **datalist)
|
||||||
{
|
{
|
||||||
g_pointer_bit_lock ((void **) datalist, DATALIST_LOCK_BIT);
|
guintptr ptr;
|
||||||
return G_DATALIST_GET_POINTER (datalist);
|
|
||||||
|
g_pointer_bit_lock_and_get ((void **) datalist, DATALIST_LOCK_BIT, &ptr);
|
||||||
|
return G_DATALIST_CLEAN_POINTER (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user