From cbb8f9f637eae65e0ceb9b70ff6f382f75330142 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Sun, 2 Oct 2005 21:06:02 +0000 Subject: [PATCH] ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_uri_get_protocols): protect gst_gnomevfs_get_supported_uris by a mutex... Original commit message from CVS: * ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_uri_get_protocols): protect gst_gnomevfs_get_supported_uris by a mutex, to make it MT safe. --- ChangeLog | 6 ++++++ ext/gnomevfs/gstgnomevfssrc.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8dc864af78..b89ea06c5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-02 Johan Dahlin + + * ext/gnomevfs/gstgnomevfssrc.c (gst_gnomevfssrc_uri_get_protocols): + protect gst_gnomevfs_get_supported_uris by a mutex, to make it + MT safe. + 2005-10-02 Andy Wingo * gst-libs/gst/audio/gstringbuffer.c (gst_ring_buffer_clear) diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index 92914a16b1..bee1ffa4a3 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -106,6 +106,7 @@ typedef struct _GstGnomeVFSSrc gint audiocast_thread_die_outfd; gint audiocast_port; gint audiocast_fd; + GMutex *list_uris_mutex; } GstGnomeVFSSrc; typedef struct _GstGnomeVFSSrcClass @@ -343,9 +344,16 @@ static gchar ** gst_gnomevfssrc_uri_get_protocols (void) { static gchar **protocols = NULL; + static GMutex *mutex = NULL; - if (!protocols) + if (G_UNLIKELY (!protocols)) { + if (!mutex) + mutex = g_mutex_new (); + + g_mutex_lock (mutex); protocols = gst_gnomevfs_get_supported_uris (); + g_mutex_unlock (mutex); + } return protocols; }