buffer: Use C11 atomics if available for 64 bit atomic operations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6740>
This commit is contained in:
Sebastian Dröge 2024-05-15 09:27:26 +03:00 committed by GStreamer Marge Bot
parent 8ea355e52c
commit 0a2e0a4f64

View file

@ -172,7 +172,14 @@ typedef struct
static gint64 meta_seq; /* 0 *//* ATOMIC */
/* TODO: use GLib's once https://gitlab.gnome.org/GNOME/glib/issues/1076 lands */
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__)
#include <stdatomic.h>
static inline gint64
gst_atomic_int64_inc (gint64 * atomic)
{
return atomic_fetch_add ((_Atomic gint64 *) atomic, 1);
}
#elif defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
static inline gint64
gst_atomic_int64_inc (gint64 * atomic)
{