summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-10-08 09:34:47 +0100
committerTim-Philipp Müller <tim@centricular.net>2012-09-11 01:54:40 +0100
commit2c9ac5a4c952692af14b6f137dc29425b0f3be55 (patch)
treed1e08bd41b62b25d4b9d91f1d917d7a18d223ec2
parentdbbbe595778d74b890649ac33a9ff3e08dbf0310 (diff)
gdp: make public enum _get_type() functions thread-safe
Not that it is likely to matter in practice, but since these are public API they should probably be thread-safe.
-rw-r--r--gst/gdp/dataprotocol.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c
index 5e413b05a..b57d377d6 100644
--- a/gst/gdp/dataprotocol.c
+++ b/gst/gdp/dataprotocol.c
@@ -292,18 +292,19 @@ gst_dp_dump_byte_array (guint8 * array, guint length)
GType
gst_dp_version_get_type (void)
{
- static GType gst_dp_version_type = 0;
+ static gsize gst_dp_version_type = 0;
static const GEnumValue gst_dp_version[] = {
{GST_DP_VERSION_0_2, "GST_DP_VERSION_0_2", "0.2"},
{GST_DP_VERSION_1_0, "GST_DP_VERSION_1_0", "1.0"},
{0, NULL, NULL},
};
- if (!gst_dp_version_type) {
- gst_dp_version_type =
- g_enum_register_static ("GstDPVersion", gst_dp_version);
+ if (g_once_init_enter (&gst_dp_version_type)) {
+ GType tmp = g_enum_register_static ("GstDPVersion", gst_dp_version);
+ g_once_init_leave (&gst_dp_version_type, tmp);
}
- return gst_dp_version_type;
+
+ return (GType) gst_dp_version_type;
};
/**