Skip to content

gobject: Use compare and exchange full to re-read old ref value

Marco Trevisan requested to merge 3v1n0/glib:atomic-unref-cleanups into main

In case g_atomic_int_compare_and_exchange() check fails we ended up doing another atomic get to figure out what it was the old reference count, however, we can avoid this by using the full version of the function that returns the value before the exchange happened as an out value.

Added also more commits to cleanup some code that this change allows. Can be split out in case.

Edited by Marco Trevisan

Merge request reports