gst: don't use volatile to mean atomic

volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/793>
This commit is contained in:
Matthew Waters 2021-03-18 14:46:15 +11:00 committed by Tim-Philipp Müller
parent 934e6bb114
commit fdf6a793dc
37 changed files with 71 additions and 72 deletions

View file

@ -57,9 +57,9 @@ struct _GstAQueueMem
{ {
gint size; gint size;
gpointer *array; gpointer *array;
volatile gint head; gint head;
volatile gint tail_write; gint tail_write;
volatile gint tail_read; gint tail_read;
GstAQueueMem *next; GstAQueueMem *next;
GstAQueueMem *free; GstAQueueMem *free;
}; };
@ -103,7 +103,7 @@ free_queue_mem (GstAQueueMem * mem)
struct _GstAtomicQueue struct _GstAtomicQueue
{ {
volatile gint refcount; gint refcount;
#ifdef LOW_MEM #ifdef LOW_MEM
gint num_readers; gint num_readers;
#endif #endif

View file

@ -172,14 +172,14 @@ 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(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
static inline gint64 static inline gint64
gst_atomic_int64_inc (volatile gint64 * atomic) gst_atomic_int64_inc (gint64 * atomic)
{ {
return __sync_fetch_and_add (atomic, 1); return __sync_fetch_and_add (atomic, 1);
} }
#elif defined (G_PLATFORM_WIN32) #elif defined (G_PLATFORM_WIN32)
#include <windows.h> #include <windows.h>
static inline gint64 static inline gint64
gst_atomic_int64_inc (volatile gint64 * atomic) gst_atomic_int64_inc (gint64 * atomic)
{ {
return InterlockedExchangeAdd64 (atomic, 1); return InterlockedExchangeAdd64 (atomic, 1);
} }
@ -191,7 +191,7 @@ gst_atomic_int64_inc (volatile gint64 * atomic)
#define NO_64BIT_ATOMIC_INT_FOR_PLATFORM #define NO_64BIT_ATOMIC_INT_FOR_PLATFORM
G_LOCK_DEFINE_STATIC (meta_seq); G_LOCK_DEFINE_STATIC (meta_seq);
static inline gint64 static inline gint64
gst_atomic_int64_inc (volatile gint64 * atomic) gst_atomic_int64_inc (gint64 * atomic)
{ {
gint64 ret; gint64 ret;
@ -2643,7 +2643,7 @@ static gboolean
_gst_parent_buffer_meta_init (GstParentBufferMeta * parent_meta, _gst_parent_buffer_meta_init (GstParentBufferMeta * parent_meta,
gpointer params, GstBuffer * buffer) gpointer params, GstBuffer * buffer)
{ {
static volatile gsize _init; static gsize _init;
if (g_once_init_enter (&_init)) { if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_parent_buffer_meta_debug, "parentbuffermeta", GST_DEBUG_CATEGORY_INIT (gst_parent_buffer_meta_debug, "parentbuffermeta",
@ -2662,7 +2662,7 @@ _gst_parent_buffer_meta_init (GstParentBufferMeta * parent_meta,
GType GType
gst_parent_buffer_meta_api_get_type (void) gst_parent_buffer_meta_api_get_type (void)
{ {
static volatile GType type = 0; static GType type = 0;
static const gchar *tags[] = { NULL }; static const gchar *tags[] = { NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {
@ -2812,7 +2812,7 @@ static gboolean
_gst_reference_timestamp_meta_init (GstReferenceTimestampMeta * meta, _gst_reference_timestamp_meta_init (GstReferenceTimestampMeta * meta,
gpointer params, GstBuffer * buffer) gpointer params, GstBuffer * buffer)
{ {
static volatile gsize _init; static gsize _init;
if (g_once_init_enter (&_init)) { if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_reference_timestamp_meta_debug, GST_DEBUG_CATEGORY_INIT (gst_reference_timestamp_meta_debug,
@ -2833,7 +2833,7 @@ _gst_reference_timestamp_meta_init (GstReferenceTimestampMeta * meta,
GType GType
gst_reference_timestamp_meta_api_get_type (void) gst_reference_timestamp_meta_api_get_type (void)
{ {
static volatile GType type = 0; static GType type = 0;
static const gchar *tags[] = { NULL }; static const gchar *tags[] = { NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {

View file

@ -560,7 +560,7 @@ gst_child_proxy_base_init (gpointer g_class)
GType GType
gst_child_proxy_get_type (void) gst_child_proxy_get_type (void)
{ {
static volatile gsize type = 0; static gsize type = 0;
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {
GType _type; GType _type;

View file

@ -84,7 +84,7 @@ static gint private_offset = 0;
GType GType
gst_device_provider_get_type (void) gst_device_provider_get_type (void)
{ {
static volatile gsize gst_device_provider_type = 0; static gsize gst_device_provider_type = 0;
if (g_once_init_enter (&gst_device_provider_type)) { if (g_once_init_enter (&gst_device_provider_type)) {
GType _type; GType _type;

View file

@ -169,7 +169,7 @@ GQuark __gst_elementclass_factory = 0;
GType GType
gst_element_get_type (void) gst_element_get_type (void)
{ {
static volatile gsize gst_element_type = 0; static gsize gst_element_type = 0;
if (g_once_init_enter (&gst_element_type)) { if (g_once_init_enter (&gst_element_type)) {
GType _type; GType _type;

View file

@ -302,8 +302,8 @@ static gboolean add_default_log_func = TRUE;
#define PRETTY_TAGS_DEFAULT TRUE #define PRETTY_TAGS_DEFAULT TRUE
static gboolean pretty_tags = PRETTY_TAGS_DEFAULT; static gboolean pretty_tags = PRETTY_TAGS_DEFAULT;
static volatile gint G_GNUC_MAY_ALIAS __default_level = GST_LEVEL_DEFAULT; static gint G_GNUC_MAY_ALIAS __default_level = GST_LEVEL_DEFAULT;
static volatile gint G_GNUC_MAY_ALIAS __use_color = GST_DEBUG_COLOR_MODE_ON; static gint G_GNUC_MAY_ALIAS __use_color = GST_DEBUG_COLOR_MODE_ON;
/* FIXME: export this? */ /* FIXME: export this? */
gboolean gboolean

View file

@ -123,7 +123,7 @@ _gst_param_fraction_values_cmp (GParamSpec * pspec, const GValue * value1,
GType GType
gst_param_spec_fraction_get_type (void) gst_param_spec_fraction_get_type (void)
{ {
static volatile GType gst_faction_type = 0; static GType gst_faction_type = 0;
/* register GST_TYPE_PARAM_FRACTION */ /* register GST_TYPE_PARAM_FRACTION */
if (g_once_init_enter (&gst_faction_type)) { if (g_once_init_enter (&gst_faction_type)) {
@ -304,7 +304,7 @@ _gst_param_array_values_cmp (GParamSpec * pspec, const GValue * value1,
GType GType
gst_param_spec_array_get_type (void) gst_param_spec_array_get_type (void)
{ {
static volatile GType gst_array_type = 0; static GType gst_array_type = 0;
/* register GST_TYPE_PARAM_FRACTION */ /* register GST_TYPE_PARAM_FRACTION */
if (g_once_init_enter (&gst_array_type)) { if (g_once_init_enter (&gst_array_type)) {

View file

@ -381,7 +381,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
static gboolean static gboolean
gst_plugin_loader_use_usr_bin_arch (void) gst_plugin_loader_use_usr_bin_arch (void)
{ {
static volatile gsize multiarch = 0; static gsize multiarch = 0;
if (g_once_init_enter (&multiarch)) { if (g_once_init_enter (&multiarch)) {
gsize res = NO_MULTIARCH; gsize res = NO_MULTIARCH;

View file

@ -151,11 +151,11 @@ struct _GstPoll
#endif #endif
gboolean controllable; gboolean controllable;
volatile gint waiting; gint waiting;
volatile gint control_pending; gint control_pending;
volatile gint flushing; gint flushing;
gboolean timer; gboolean timer;
volatile gint rebuild; gint rebuild;
}; };
static gboolean gst_poll_fd_ctl_read_unlocked (GstPoll * set, GstPollFD * fd, static gboolean gst_poll_fd_ctl_read_unlocked (GstPoll * set, GstPollFD * fd,

View file

@ -1322,7 +1322,7 @@ gst_preset_base_init (gpointer g_class)
GType GType
gst_preset_get_type (void) gst_preset_get_type (void)
{ {
static volatile gsize type = 0; static gsize type = 0;
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {
GType _type; GType _type;

View file

@ -347,7 +347,7 @@ gst_promise_free (GstMiniObject * object)
static void static void
gst_promise_init (GstPromise * promise) gst_promise_init (GstPromise * promise)
{ {
static volatile gsize _init = 0; static gsize _init = 0;
if (g_once_init_enter (&_init)) { if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_promise_debug, "gstpromise", 0, "gstpromise"); GST_DEBUG_CATEGORY_INIT (gst_promise_debug, "gstpromise", 0, "gstpromise");

View file

@ -56,7 +56,7 @@ static const gchar *gst_protection_factory_check (GstElementFactory * fact,
GType GType
gst_protection_meta_api_get_type (void) gst_protection_meta_api_get_type (void)
{ {
static volatile GType type; static GType type;
static const gchar *tags[] = { NULL }; static const gchar *tags[] = { NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {

View file

@ -148,7 +148,7 @@ gst_task_win32_load_library (void)
{ {
/* FIXME: Add support for UWP app */ /* FIXME: Add support for UWP app */
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
static volatile gsize _init_once = 0; static gsize _init_once = 0;
if (g_once_init_enter (&_init_once)) { if (g_once_init_enter (&_init_once)) {
kernel32_module = LoadLibraryW (L"kernel32.dll"); kernel32_module = LoadLibraryW (L"kernel32.dll");
if (kernel32_module) { if (kernel32_module) {

View file

@ -123,7 +123,7 @@ _gst_ascii_strcasestr (const gchar * s, const gchar * find)
GType GType
gst_uri_handler_get_type (void) gst_uri_handler_get_type (void)
{ {
static volatile gsize urihandler_type = 0; static gsize urihandler_type = 0;
if (g_once_init_enter (&urihandler_type)) { if (g_once_init_enter (&urihandler_type)) {
GType _type; GType _type;

View file

@ -2267,7 +2267,7 @@ static GstValueAbbreviation *
_priv_gst_value_get_abbrs (gint * n_abbrs) _priv_gst_value_get_abbrs (gint * n_abbrs)
{ {
static GstValueAbbreviation *abbrs = NULL; static GstValueAbbreviation *abbrs = NULL;
static volatile gsize num = 0; static gsize num = 0;
if (g_once_init_enter (&num)) { if (g_once_init_enter (&num)) {
/* dynamically generate the array */ /* dynamically generate the array */
@ -7617,7 +7617,7 @@ GType _gst_ ## type ## _type = 0; \
\ \
GType gst_ ## type ## _get_type (void) \ GType gst_ ## type ## _get_type (void) \
{ \ { \
static volatile GType gst_ ## type ## _type = 0; \ static GType gst_ ## type ## _type = 0; \
\ \
if (g_once_init_enter (&gst_ ## type ## _type)) { \ if (g_once_init_enter (&gst_ ## type ## _type)) { \
GType _type; \ GType _type; \
@ -7947,9 +7947,8 @@ _priv_gst_value_initialize (void)
GST_TYPE_FRACTION_RANGE, GST_TYPE_FRACTION_RANGE,
gst_value_subtract_fraction_range_fraction_range); gst_value_subtract_fraction_range_fraction_range);
/* see bug #317246, #64994, #65041 */
{ {
volatile GType date_type = G_TYPE_DATE; GType date_type = G_TYPE_DATE;
g_type_name (date_type); g_type_name (date_type);
} }

View file

@ -2878,7 +2878,7 @@ gst_aggregator_init (GstAggregator * self, GstAggregatorClass * klass)
GType GType
gst_aggregator_get_type (void) gst_aggregator_get_type (void)
{ {
static volatile gsize type = 0; static gsize type = 0;
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {
GType _type; GType _type;

View file

@ -377,7 +377,7 @@ static void gst_base_parse_init (GstBaseParse * parse,
GType GType
gst_base_parse_get_type (void) gst_base_parse_get_type (void)
{ {
static volatile gsize base_parse_type = 0; static gsize base_parse_type = 0;
if (g_once_init_enter (&base_parse_type)) { if (g_once_init_enter (&base_parse_type)) {
static const GTypeInfo base_parse_info = { static const GTypeInfo base_parse_info = {

View file

@ -338,7 +338,7 @@ static void gst_base_sink_finalize (GObject * object);
GType GType
gst_base_sink_get_type (void) gst_base_sink_get_type (void)
{ {
static volatile gsize base_sink_type = 0; static gsize base_sink_type = 0;
if (g_once_init_enter (&base_sink_type)) { if (g_once_init_enter (&base_sink_type)) {
GType _type; GType _type;

View file

@ -238,8 +238,8 @@ struct _GstBaseSrcPrivate
GstClockTimeDiff ts_offset; /* OBJECT_LOCK */ GstClockTimeDiff ts_offset; /* OBJECT_LOCK */
gboolean do_timestamp; /* OBJECT_LOCK */ gboolean do_timestamp; /* OBJECT_LOCK */
volatile gint dynamic_size; /* atomic */ gint dynamic_size; /* atomic */
volatile gint automatic_eos; /* atomic */ gint automatic_eos; /* atomic */
/* stream sequence number */ /* stream sequence number */
guint32 seqnum; /* STREAM_LOCK */ guint32 seqnum; /* STREAM_LOCK */
@ -247,7 +247,7 @@ struct _GstBaseSrcPrivate
/* pending events (TAG, CUSTOM_BOTH, CUSTOM_DOWNSTREAM) to be /* pending events (TAG, CUSTOM_BOTH, CUSTOM_DOWNSTREAM) to be
* pushed in the data stream */ * pushed in the data stream */
GList *pending_events; /* OBJECT_LOCK */ GList *pending_events; /* OBJECT_LOCK */
volatile gint have_events; /* OBJECT_LOCK */ gint have_events; /* OBJECT_LOCK */
/* QoS *//* with LOCK */ /* QoS *//* with LOCK */
gdouble proportion; /* OBJECT_LOCK */ gdouble proportion; /* OBJECT_LOCK */
@ -277,7 +277,7 @@ static void gst_base_src_finalize (GObject * object);
GType GType
gst_base_src_get_type (void) gst_base_src_get_type (void)
{ {
static volatile gsize base_src_type = 0; static gsize base_src_type = 0;
if (g_once_init_enter (&base_src_type)) { if (g_once_init_enter (&base_src_type)) {
GType _type; GType _type;
@ -442,7 +442,7 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class)
g_cond_init (&basesrc->live_cond); g_cond_init (&basesrc->live_cond);
basesrc->num_buffers = DEFAULT_NUM_BUFFERS; basesrc->num_buffers = DEFAULT_NUM_BUFFERS;
basesrc->num_buffers_left = -1; basesrc->num_buffers_left = -1;
basesrc->priv->automatic_eos = TRUE; g_atomic_int_set (&basesrc->priv->automatic_eos, TRUE);
basesrc->can_activate_push = TRUE; basesrc->can_activate_push = TRUE;

View file

@ -219,7 +219,7 @@ static GstFlowReturn default_generate_output (GstBaseTransform * trans,
GType GType
gst_base_transform_get_type (void) gst_base_transform_get_type (void)
{ {
static volatile gsize base_transform_type = 0; static gsize base_transform_type = 0;
if (g_once_init_enter (&base_transform_type)) { if (g_once_init_enter (&base_transform_type)) {
GType _type; GType _type;

View file

@ -72,7 +72,7 @@ struct _GstFlowCombiner
GQueue pads; GQueue pads;
GstFlowReturn last_ret; GstFlowReturn last_ret;
volatile gint ref_count; gint ref_count;
}; };
GST_DEBUG_CATEGORY_STATIC (flowcombiner_dbg); GST_DEBUG_CATEGORY_STATIC (flowcombiner_dbg);
@ -99,7 +99,7 @@ gst_flow_combiner_new (void)
g_queue_init (&combiner->pads); g_queue_init (&combiner->pads);
combiner->last_ret = GST_FLOW_OK; combiner->last_ret = GST_FLOW_OK;
combiner->ref_count = 1; g_atomic_int_set (&combiner->ref_count, 1);
/* Make sure debug category is initialised */ /* Make sure debug category is initialised */
gst_flow_combiner_get_type (); gst_flow_combiner_get_type ();

View file

@ -38,12 +38,12 @@
struct _GstStreamConsistency struct _GstStreamConsistency
{ {
/* FIXME: do we want to track some states per pad? */ /* FIXME: do we want to track some states per pad? */
volatile gboolean flushing; gboolean flushing;
volatile gboolean segment; gboolean segment;
volatile gboolean eos; gboolean eos;
volatile gboolean expect_flush; gboolean expect_flush;
volatile gboolean saw_serialized_event; gboolean saw_serialized_event;
volatile gboolean saw_stream_start; gboolean saw_stream_start;
GstObject *parent; GstObject *parent;
GList *pads; GList *pads;
}; };

View file

@ -172,9 +172,9 @@ struct _GstHarnessPrivate
GstPad *sink_forward_pad; GstPad *sink_forward_pad;
GstTestClock *testclock; GstTestClock *testclock;
volatile gint recv_buffers; gint recv_buffers;
volatile gint recv_events; gint recv_events;
volatile gint recv_upstream_events; gint recv_upstream_events;
GAsyncQueue *buffer_queue; GAsyncQueue *buffer_queue;
GAsyncQueue *src_event_queue; GAsyncQueue *src_event_queue;

View file

@ -98,7 +98,7 @@ gst_control_point_copy (GstControlPoint * cp)
GType GType
gst_control_point_get_type (void) gst_control_point_get_type (void)
{ {
static volatile gsize type_id = 0; static gsize type_id = 0;
if (g_once_init_enter (&type_id)) { if (g_once_init_enter (&type_id)) {
GType tmp = GType tmp =

View file

@ -72,7 +72,7 @@ net_address_meta_free (GstMeta * meta, GstBuffer * buffer)
GType GType
gst_net_address_meta_api_get_type (void) gst_net_address_meta_api_get_type (void)
{ {
static volatile GType type; static GType type;
static const gchar *tags[] = { "origin", NULL }; static const gchar *tags[] = { "origin", NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {

View file

@ -75,7 +75,7 @@ net_control_message_meta_free (GstMeta * meta, GstBuffer * buffer)
GType GType
gst_net_control_message_meta_api_get_type (void) gst_net_control_message_meta_api_get_type (void)
{ {
static volatile GType type; static GType type;
static const gchar *tags[] = { "origin", NULL }; static const gchar *tags[] = { "origin", NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {

View file

@ -110,7 +110,7 @@ typedef struct _GstSingleQueue GstSingleQueue;
struct _GstSingleQueue struct _GstSingleQueue
{ {
volatile gint refcount; gint refcount;
/* unique identifier of the queue */ /* unique identifier of the queue */
guint id; guint id;
@ -3379,7 +3379,7 @@ gst_single_queue_new (GstMultiQueue * mqueue, guint id)
} }
sq = g_new0 (GstSingleQueue, 1); sq = g_new0 (GstSingleQueue, 1);
sq->refcount = 1; g_atomic_int_set (&sq->refcount, 1);
mqueue->nbqueues++; mqueue->nbqueues++;
sq->id = temp_id; sq->id = temp_id;

View file

@ -164,7 +164,7 @@ struct _GstQueue2
guint64 ring_buffer_max_size; guint64 ring_buffer_max_size;
guint8 * ring_buffer; guint8 * ring_buffer;
volatile gint downstream_may_block; gint downstream_may_block;
GstBufferingMode mode; GstBufferingMode mode;
gint64 buffering_left; gint64 buffering_left;

View file

@ -55,7 +55,7 @@ struct _GstValve
GstElement parent; GstElement parent;
/* atomic boolean */ /* atomic boolean */
volatile gint drop; gint drop;
/* Protected by the stream lock */ /* Protected by the stream lock */
gboolean discont; gboolean discont;

View file

@ -181,7 +181,7 @@ gst_test_obj_class_init (GstTestObjClass * klass)
static GType static GType
gst_test_obj_get_type (void) gst_test_obj_get_type (void)
{ {
static volatile gsize test_obj_type = 0; static gsize test_obj_type = 0;
if (g_once_init_enter (&test_obj_type)) { if (g_once_init_enter (&test_obj_type)) {
GType type; GType type;
@ -276,7 +276,7 @@ gst_test_control_source_init (GstTestControlSource * self)
static GType static GType
gst_test_control_source_get_type (void) gst_test_control_source_get_type (void)
{ {
static volatile gsize test_countrol_source_type = 0; static gsize test_countrol_source_type = 0;
if (g_once_init_enter (&test_countrol_source_type)) { if (g_once_init_enter (&test_countrol_source_type)) {
GType type; GType type;
@ -406,7 +406,7 @@ gst_test_control_binding_class_init (gpointer klass, gpointer class_data)
static GType static GType
gst_test_control_binding_get_type (void) gst_test_control_binding_get_type (void)
{ {
static volatile gsize test_countrol_binding_type = 0; static gsize test_countrol_binding_type = 0;
if (g_once_init_enter (&test_countrol_binding_type)) { if (g_once_init_enter (&test_countrol_binding_type)) {
GType type; GType type;

View file

@ -135,7 +135,7 @@ test_transform_func (GstBuffer * transbuf, GstMeta * meta,
static GType static GType
gst_meta_test_api_get_type (void) gst_meta_test_api_get_type (void)
{ {
static volatile GType type; static GType type;
static const gchar *tags[] = { "timing", NULL }; static const gchar *tags[] = { "timing", NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {
@ -193,7 +193,7 @@ foo_transform_func (GstBuffer * transbuf, GstMeta * meta,
static GType static GType
gst_meta_foo_api_get_type (void) gst_meta_foo_api_get_type (void)
{ {
static volatile GType type; static GType type;
static const gchar *tags[] = { NULL }; static const gchar *tags[] = { NULL };
if (g_once_init_enter (&type)) { if (g_once_init_enter (&type)) {

View file

@ -220,7 +220,7 @@ struct _MyBufferPool
{ {
GSList *buffers; GSList *buffers;
volatile gboolean is_closed; gboolean is_closed;
}; };
static void my_recycle_buffer_destroy (MyRecycleBuffer * buf); static void my_recycle_buffer_destroy (MyRecycleBuffer * buf);
@ -310,7 +310,7 @@ thread_buffer_producer (MyBufferPool * pool)
gst_buffer_unref (buf); gst_buffer_unref (buf);
} }
pool->is_closed = TRUE; g_atomic_int_set (&pool->is_closed, TRUE);
} }
static void static void
@ -327,7 +327,7 @@ thread_buffer_consumer (MyBufferPool * pool)
THREAD_SWITCH (); THREAD_SWITCH ();
} }
while (!pool->is_closed); while (!g_atomic_int_get (&pool->is_closed));
} }
GST_START_TEST (test_recycle_threaded) GST_START_TEST (test_recycle_threaded)

View file

@ -48,7 +48,7 @@ struct _GstFakeObjectClass
static GType static GType
gst_fake_object_get_type (void) gst_fake_object_get_type (void)
{ {
static volatile gsize fake_object_type = 0; static gsize fake_object_type = 0;
if (g_once_init_enter (&fake_object_type)) { if (g_once_init_enter (&fake_object_type)) {
GType type; GType type;

View file

@ -114,7 +114,7 @@ gst_preset_test_base_init (GstPresetTestClass * klass)
static GType static GType
gst_preset_test_get_type (void) gst_preset_test_get_type (void)
{ {
static volatile gsize preset_test_type = 0; static gsize preset_test_type = 0;
if (g_once_init_enter (&preset_test_type)) { if (g_once_init_enter (&preset_test_type)) {
GType type; GType type;

View file

@ -96,7 +96,7 @@ gst_protection_test_base_init (GstProtectionTestClass * klass)
static GType static GType
gst_protection_test_get_type (void) gst_protection_test_get_type (void)
{ {
static volatile gsize protection_test_type = 0; static gsize protection_test_type = 0;
if (g_once_init_enter (&protection_test_type)) { if (g_once_init_enter (&protection_test_type)) {
GType type; GType type;

View file

@ -240,7 +240,7 @@ gst_test_obj_base_init (GstTestObjClass * klass)
static GType static GType
gst_test_obj_get_type (void) gst_test_obj_get_type (void)
{ {
static volatile gsize test_obj_type = 0; static gsize test_obj_type = 0;
if (g_once_init_enter (&test_obj_type)) { if (g_once_init_enter (&test_obj_type)) {
GType type; GType type;

View file

@ -153,7 +153,7 @@ gst_test_obj_base_init (GstTestObjClass * klass)
static GType static GType
gst_test_obj_get_type (void) gst_test_obj_get_type (void)
{ {
static volatile gsize TEST_OBJ_type = 0; static gsize TEST_OBJ_type = 0;
if (g_once_init_enter (&TEST_OBJ_type)) { if (g_once_init_enter (&TEST_OBJ_type)) {
GType type; GType type;