mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-02 02:40:07 +02:00
Merge branch 'gclosure-atomic-oops' into 'main'
gclosure: fix ATOMIC_CHANGE_FIELD to read vint atomically See merge request GNOME/glib!4575
This commit is contained in:
commit
148c1ed891
@ -110,15 +110,17 @@ typedef union {
|
|||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
ClosureInt *cunion = (ClosureInt*) _closure; \
|
ClosureInt *cunion = (ClosureInt*) _closure; \
|
||||||
gint new_int, old_int, success; \
|
gint new_int, old_int, success; \
|
||||||
|
old_int = g_atomic_int_get (&cunion->vint); \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
ClosureInt tmp; \
|
ClosureInt tmp; \
|
||||||
tmp.vint = old_int = cunion->vint; \
|
tmp.vint = old_int; \
|
||||||
_SET_OLD tmp.closure._field; \
|
_SET_OLD tmp.closure._field; \
|
||||||
tmp.closure._field _OP _value; \
|
tmp.closure._field _OP _value; \
|
||||||
_SET_NEW tmp.closure._field; \
|
_SET_NEW tmp.closure._field; \
|
||||||
new_int = tmp.vint; \
|
new_int = tmp.vint; \
|
||||||
success = g_atomic_int_compare_and_exchange (&cunion->vint, old_int, new_int); \
|
success = g_atomic_int_compare_and_exchange_full (&cunion->vint, old_int, new_int,\
|
||||||
|
&old_int); \
|
||||||
} \
|
} \
|
||||||
while (!success && _must_set); \
|
while (!success && _must_set); \
|
||||||
} G_STMT_END
|
} G_STMT_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user