glib/docs
Marco Trevisan (Treviño) bfdeb37f6e gatomic: Add Compare and Exchange functions that returns the previous value
Atomic primitives allow to do conditional compare and exchange but also
to get the value that was previously stored in the atomic variable.

Now, we provided an exchange function that allows to do an exchange if
the atomic value matches an expected value but we had no way to know
at the same time what was the value in the atomic at the moment of the
exchange try, an this can be useful in case that the operation fails,
for example if the current value is still acceptable for us, allowing
to do a kind of "OR" check:

  gint old_value;
  gint valid_value = 222;
  while (!g_atomic_pointer_compare_and_exchange_value (&atomic,
                                                       valid_value, 555,
                                                       &old_value)
    {
      if (old_value == 555 || old_value == 222)
        valid_value = old_value;
    }
2022-06-22 23:01:19 +02:00
..
reference gatomic: Add Compare and Exchange functions that returns the previous value 2022-06-22 23:01:19 +02:00
backports.md docs: Add a backports policy 2022-05-19 12:52:26 +01:00
CODEOWNERS docs: Add Marco Trevisan as a co-maintainer 2022-06-20 16:03:01 +00:00
debugging.txt tree: Fix various typos and outdated terminology 2020-06-12 15:01:08 +01:00
macros.txt build: Add glib_debug option 2021-01-20 16:05:36 +01:00
meson-version.md docs: Add a Meson version policy 2022-05-06 13:01:44 +01:00
rationales.md docs: Move README.rationale to docs subdirectory 2022-05-11 13:02:49 +01:00
roadmap.md docs: Add a roadmap policy 2022-05-22 17:10:52 +01:00
supported-platforms.md docs: Update supported platforms list 2022-05-18 08:36:50 +01:00
toolchain-requirements.md docs: Add compiler and toolchain requirements from the wiki 2022-05-18 08:36:36 +01:00