From 1a9c07e5ba0eab211e9c05c160e7e8a8ec544d0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 26 Apr 2010 11:11:37 +0200 Subject: [PATCH] playbin: Use g_once_init_{enter,leave} instead of GOnce for enum/flag registration --- gst/playback/gstplay-enum.c | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/gst/playback/gstplay-enum.c b/gst/playback/gstplay-enum.c index 60c448c840..b064df56e4 100644 --- a/gst/playback/gstplay-enum.c +++ b/gst/playback/gstplay-enum.c @@ -22,8 +22,8 @@ #define C_ENUM(v) ((gint) v) #define C_FLAGS(v) ((guint) v) -static void -register_gst_autoplug_select_result (GType * id) +GType +gst_autoplug_select_result_get_type (void) { static const GEnumValue values[] = { {C_ENUM (GST_AUTOPLUG_SELECT_TRY), "GST_AUTOPLUG_SELECT_TRY", "try"}, @@ -32,21 +32,21 @@ register_gst_autoplug_select_result (GType * id) {C_ENUM (GST_AUTOPLUG_SELECT_SKIP), "GST_AUTOPLUG_SELECT_SKIP", "skip"}, {0, NULL, NULL} }; - *id = g_enum_register_static ("GstAutoplugSelectResult", values); -} + static volatile GType id = 0; -GType -gst_autoplug_select_result_get_type (void) -{ - static GType id; - static GOnce once = G_ONCE_INIT; + if (g_once_init_enter ((gsize *) & id)) { + GType _id; + + _id = g_enum_register_static ("GstAutoplugSelectResult", values); + + g_once_init_leave ((gsize *) & id, _id); + } - g_once (&once, (GThreadFunc) register_gst_autoplug_select_result, &id); return id; } -static void -register_gst_play_flags (GType * id) +GType +gst_play_flags_get_type (void) { static const GFlagsValue values[] = { {C_FLAGS (GST_PLAY_FLAG_VIDEO), "Render the video stream", "video"}, @@ -65,15 +65,15 @@ register_gst_play_flags (GType * id) "buffering"}, {0, NULL, NULL} }; - *id = g_flags_register_static ("GstPlayFlags", values); -} + static volatile GType id = 0; -GType -gst_play_flags_get_type (void) -{ - static GType id; - static GOnce once = G_ONCE_INIT; + if (g_once_init_enter ((gsize *) & id)) { + GType _id; + + _id = g_flags_register_static ("GstPlayFlags", values); + + g_once_init_leave ((gsize *) & id, _id); + } - g_once (&once, (GThreadFunc) register_gst_play_flags, &id); return id; }