summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-12-31 12:08:19 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-12-31 12:08:19 +0000
commit7f7721511c5d5f2b0f32a61f91cb2df7e573653d (patch)
tree6714a16f245267c7fd4c8d310b3082b01230c2b6
parent07e2428afd6de081ada59aad29ae22b4d300727c (diff)
inputselector: make pad's get_type function thread-safe
-rw-r--r--plugins/elements/gstinputselector.c36
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
@@ -154,32 +154,32 @@ static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
static GType
gst_selector_pad_get_type (void)
{
- static GType selector_pad_type = 0;
-
- if (!selector_pad_type) {
- static const GTypeInfo selector_pad_info = {
- sizeof (GstSelectorPadClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_selector_pad_class_init,
- NULL,
- NULL,
- sizeof (GstSelectorPad),
- 0,
- (GInstanceInitFunc) gst_selector_pad_init,
- };
-
- selector_pad_type =
- g_type_register_static (GST_TYPE_PAD, "GstSelectorPad",
+ static volatile gsize selector_pad_type = 0;
+ static const GTypeInfo selector_pad_info = {
+ sizeof (GstSelectorPadClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_selector_pad_class_init,
+ NULL,
+ NULL,
+ sizeof (GstSelectorPad),
+ 0,
+ (GInstanceInitFunc) gst_selector_pad_init,
+ };
+
+ if (g_once_init_enter (&selector_pad_type)) {
+ GType tmp = g_type_register_static (GST_TYPE_PAD, "GstSelectorPad",
&selector_pad_info, 0);
+ g_once_init_leave (&selector_pad_type, tmp);
}
- return selector_pad_type;
+
+ return (GType) selector_pad_type;
}
static void
gst_selector_pad_class_init (GstSelectorPadClass * klass)
{
GObjectClass *gobject_class;