mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
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:
parent
8ea355e52c
commit
0a2e0a4f64
1 changed files with 8 additions and 1 deletions
|
@ -172,7 +172,14 @@ typedef struct
|
||||||
static gint64 meta_seq; /* 0 *//* ATOMIC */
|
static gint64 meta_seq; /* 0 *//* ATOMIC */
|
||||||
|
|
||||||
/* TODO: use GLib's once https://gitlab.gnome.org/GNOME/glib/issues/1076 lands */
|
/* 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
|
static inline gint64
|
||||||
gst_atomic_int64_inc (gint64 * atomic)
|
gst_atomic_int64_inc (gint64 * atomic)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue