diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-12-31 12:08:19 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-12-31 12:08:19 +0000 |
commit | 7f7721511c5d5f2b0f32a61f91cb2df7e573653d (patch) | |
tree | 6714a16f245267c7fd4c8d310b3082b01230c2b6 | |
parent | 07e2428afd6de081ada59aad29ae22b4d300727c (diff) |
inputselector: make pad's get_type function thread-safe
-rw-r--r-- | plugins/elements/gstinputselector.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/plugins/elements/gstinputselector.c b/plugins/elements/gstinputselector.c index 4dc7dc60bb..e64aa1c42a 100644 --- a/plugins/elements/gstinputselector.c +++ b/plugins/elements/gstinputselector.c | |||
@@ -157,26 +157,26 @@ static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad, | |||
157 | static GType | 157 | static GType |
158 | gst_selector_pad_get_type (void) | 158 | gst_selector_pad_get_type (void) |
159 | { | 159 | { |
160 | static GType selector_pad_type = 0; | 160 | static volatile gsize selector_pad_type = 0; |
161 | 161 | static const GTypeInfo selector_pad_info = { | |
162 | if (!selector_pad_type) { | 162 | sizeof (GstSelectorPadClass), |
163 | static const GTypeInfo selector_pad_info = { | 163 | NULL, |
164 | sizeof (GstSelectorPadClass), | 164 | NULL, |
165 | NULL, | 165 | (GClassInitFunc) gst_selector_pad_class_init, |
166 | NULL, | 166 | NULL, |
167 | (GClassInitFunc) gst_selector_pad_class_init, | 167 | NULL, |
168 | NULL, | 168 | sizeof (GstSelectorPad), |
169 | NULL, | 169 | 0, |
170 | sizeof (GstSelectorPad), | 170 | (GInstanceInitFunc) gst_selector_pad_init, |
171 | 0, | 171 | }; |
172 | (GInstanceInitFunc) gst_selector_pad_init, | 172 | |
173 | }; | 173 | if (g_once_init_enter (&selector_pad_type)) { |
174 | 174 | GType tmp = g_type_register_static (GST_TYPE_PAD, "GstSelectorPad", | |
175 | selector_pad_type = | ||
176 | g_type_register_static (GST_TYPE_PAD, "GstSelectorPad", | ||
177 | &selector_pad_info, 0); | 175 | &selector_pad_info, 0); |
176 | g_once_init_leave (&selector_pad_type, tmp); | ||
178 | } | 177 | } |
179 | return selector_pad_type; | 178 | |
179 | return (GType) selector_pad_type; | ||
180 | } | 180 | } |
181 | 181 | ||
182 | static void | 182 | static void |