mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-12 20:36:15 +01:00
9e5a53d576
We have a common pattern for reference counting in GLib, but we always implement it with ad hoc code. This is a good chance at trying to standardise the implementation and make it public, so that other code using GLib can take advantage of shared behaviour and semantics. Instead of simply taking an integer variable, we should create type aliases, to immediately distinguish the reference counting semantics of the code; we can handle mixing atomic reference counting with a non-atomic type (and vice versa) by using differently signed values for the atomic and non-atomic cases. The gatomicrefcount type is modelled on the Linux kernel refcount_t type; the grefcount type is added to let single-threaded code bases to avoid paying the price of atomic memory barriers on reference counting operations. |
||
---|---|---|
.. | ||
reference | ||
debugging.txt | ||
macros.txt | ||
Makefile.am |