glib/gobject
Thomas Haller 5609370de9 gbitlock: add g_pointer_bit_lock_and_get()
Usually, after g_pointer_bit_lock() we want to read the pointer that we
have. In many cases, when we g_pointer_bit_lock() a pointer, we can
access it afterwards without atomic, as nobody is going to modify the
pointer then.

However, gdataset also supports g_datalist_set_flags(), so the pointer
may change at any time and we must always use atomics to read it. For
that reason, g_datalist_lock_and_get() does an atomic read right after
g_pointer_bit_lock().

g_pointer_bit_lock() can easily access the value that it just set. Add
g_pointer_bit_lock_and_get() which can return the value that gets set
afterwards.

Aside from saving the second atomic-get in certain scenarios, the
returned value is also atomically the one that we just set.
2024-01-16 12:50:31 +01:00
..
tests gbitlock: add g_pointer_bit_lock_and_get() 2024-01-16 12:50:31 +01:00
gatomicarray.c GAtomicArray: Ensure metadata does not misalign the payload 2023-01-29 12:36:06 +00:00
gatomicarray.h GAtomicArray: Ensure metadata does not misalign the payload 2023-01-29 12:36:06 +00:00
gbinding.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gbinding.h docs: Move the GBinding SECTION 2023-10-16 23:34:04 +01:00
gbindinggroup.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gbindinggroup.h docs: Move the GBindingGroup SECTION 2023-10-16 23:34:20 +01:00
gboxed.c Add boxed GType for GRand 2023-12-31 09:09:48 +00:00
gboxed.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gclosure.c GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE 2023-10-25 12:01:02 +01:00
gclosure.h docs: Move the GClosure SECTION 2023-10-16 23:35:05 +01:00
genums.c docs: Move enum type documentation to Markdown 2023-10-11 14:01:29 +01:00
genums.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
glib-enumtypes.c.template gobject: use g_once_init_enter_pointer for GType initializers 2023-10-04 14:50:54 +01:00
glib-enumtypes.h.template Revert "meson: Use gnome.mkenum_simple()" 2022-11-24 12:06:10 +00:00
glib-genmarshal.in Replace all uses of G_VA_COPY with Standard C va_copy 2022-10-26 18:07:55 +01:00
glib-mkenums.in mkenums: Allow , in a character literal 2023-11-21 11:54:42 +00:00
glib-types.h Add boxed GType for GRand 2023-12-31 09:09:48 +00:00
gmarshal.c Replace all uses of G_VA_COPY with Standard C va_copy 2022-10-26 18:07:55 +01:00
gmarshal.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gobject_gdb.py gobject_gdb.py: Do not break bt on optimized build 2023-12-12 17:30:01 +00:00
gobject_probes.d Add missing semicolons to gobject_probes.d 2012-10-15 19:48:44 -04:00
gobject_trace.h Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
gobject-autocleanups.h Ignore autocleanups when generating introspection data 2023-10-23 10:25:30 +01:00
gobject-query.c Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
gobject.c gobject: fix deadlock with g_weak_ref_set() 2024-01-04 16:42:59 +01:00
gobject.h docs: Move the GObject SECTION 2023-10-16 23:34:24 +01:00
gobject.rc.in meson: build Windows resource files 2018-01-04 22:19:30 +01:00
gobject.stp.in stp: add code comment to gobject.object_unref about object being dangling 2023-12-30 00:20:17 +01:00
gobjectnotifyqueue.c Replace most GObject warnings with criticals 2022-08-09 13:18:47 -05:00
gparam.c Add destructor for GParamSpecPool 2023-12-19 18:41:02 +00:00
gparam.h Add destructor for GParamSpecPool 2023-12-19 18:41:02 +00:00
gparamspecs.c GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE 2023-10-25 12:01:02 +01:00
gparamspecs.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gsignal.c gsignal: Add missing (scope forever) annotations 2023-11-29 12:04:59 +00:00
gsignal.h gsignal: fix reference to signals documentation page 2023-12-15 21:03:42 +01:00
gsignalgroup.c Remove all nicks and blurbs from param specs 2023-11-29 13:41:34 +00:00
gsignalgroup.h docs: Move the GSignalGroup SECTION 2023-10-16 23:34:44 +01:00
gsourceclosure.c gobject: use g_once_init_enter_pointer for GType initializers 2023-10-04 14:50:54 +01:00
gsourceclosure.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gtype-private.h Merge branch 'more-spdx' into 'main' 2022-07-05 11:06:49 +00:00
gtype.c Change GType print placeholders to G_GUINTPTR_FORMAT 2023-10-25 12:01:02 +01:00
gtype.h GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE 2023-10-25 12:01:02 +01:00
gtypemodule.c gtypemodule: Add assertions in finalize() 2023-12-21 18:25:36 +01:00
gtypemodule.h docs: Move the GTypeModule SECTION 2023-10-16 23:34:59 +01:00
gtypeplugin.c gobject: Fix invalid doc links 2023-10-23 11:26:53 +01:00
gtypeplugin.h docs: Move the GTypePlugin SECTION 2023-10-16 23:34:53 +01:00
gvalue.c docs: Move GValue documentation to Markdown 2023-10-11 14:01:29 +01:00
gvalue.h Rename all visibility macros 2022-10-13 20:53:56 -04:00
gvaluearray.c gobject: Fix invalid doc links 2023-10-23 11:26:53 +01:00
gvaluearray.h docs: Move the GValueArray SECTION 2023-10-16 23:34:39 +01:00
gvaluecollector.h docs: Move the value collection documentation to Markdown 2023-10-23 13:18:13 +01:00
gvaluetransform.c Add SPDX license headers for LGPL-2.1-or-later to various files 2022-06-01 12:44:23 +01:00
gvaluetypes.c gvalue: add g_value_steal_string() 2023-11-04 10:40:30 +00:00
gvaluetypes.h gvalue: add g_value_steal_string() 2023-11-04 10:40:30 +00:00
libgobject-gdb.py.in Rename gdb macros with _gdb suffix to avoid ns clashes 2016-05-23 10:52:10 -04:00
meson.build build: Move gir generation to an introspection folder 2023-12-20 21:35:53 +01:00