https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121022

--- Comment #1 from Yangfl <mmyangfl at gmail dot com> ---
The motivation:

#include <stdatomic.h>
#include <stdbool.h>

bool refcnt_release(atomic_int *refcnt) {
  int orig = atomic_fetch_sub_explicit(refcnt, 1, memory_order_release);
  if (orig > 1) {
    return false;
  }
  // atomic_thread_fence(memory_order_acquire);  // try enabling this
  return true;
}

Reply via email to