g_thread_create() is deprecated in GLib master, use g_thread_try_new() instead
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 3 Dec 2011 13:58:51 +0000 (13:58 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Sat, 3 Dec 2011 13:58:51 +0000 (13:58 +0000)
gst/gstsystemclock.c
libs/gst/check/gstcheck.h
libs/gst/net/gstnetclientclock.c
libs/gst/net/gstnettimeprovider.c

index ef691fd17de7ffc4b4ded24e245c8afd6d77d2b4..2c71489cfa2bbd20b19847e900bebc10c56b8d23 100644 (file)
@@ -735,8 +735,14 @@ gst_system_clock_start_async (GstSystemClock * clock)
   if (G_LIKELY (clock->thread != NULL))
     return TRUE;                /* Thread already running. Nothing to do */
 
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   clock->thread = g_thread_create ((GThreadFunc) gst_system_clock_async_thread,
       clock, TRUE, &error);
+#else
+  clock->thread = g_thread_try_new ("GstSystemClock",
+      (GThreadFunc) gst_system_clock_async_thread, clock, &error);
+#endif
+
   if (G_UNLIKELY (error))
     goto no_thread;
 
index 004eb7457d758a60eb28f71cf68e01c27b8d514f..e77c007bce3783f370ff579e4aa31b4e23dfc7f6 100644 (file)
@@ -277,6 +277,17 @@ MAIN_INIT();                                                       \
 MAIN_START_THREAD_FUNCTIONS(count, function, data);            \
 MAIN_SYNCHRONIZE();
 
+#if GLIB_CHECK_VERSION (2, 31, 0)
+#define g_thread_create gst_g_thread_create
+static inline GThread *
+gst_g_thread_create (GThreadFunc func, gpointer data, gboolean joinable,
+    GError **error)
+{
+  g_assert (joinable);
+  return g_thread_try_new ("gst-check", func, data, error);
+}
+#endif
+
 #define MAIN_INIT()                    \
 G_STMT_START {                         \
   _gst_check_threads_running = TRUE;   \
index dcaa975891e7cf1fc3b728ee22960cd1c2d682a0..dc56b4f09dbf42f87492205de7303b79a0634722 100644 (file)
@@ -457,9 +457,15 @@ gst_net_client_clock_start (GstNetClientClock * self)
   gst_poll_add_fd (self->priv->fdset, &self->priv->sock);
   gst_poll_fd_ctl_read (self->priv->fdset, &self->priv->sock, TRUE);
 
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   self->thread = g_thread_create (gst_net_client_clock_thread, self, TRUE,
       &error);
-  if (!self->thread)
+#else
+  self->thread = g_thread_try_new ("GstNetClientClock",
+      gst_net_client_clock_thread, self, &error);
+#endif
+
+  if (error != NULL)
     goto no_thread;
 
   return TRUE;
index b04d28243ec1ca7eafb0404dac46587f4f0ec4a4..8e3e7f6d1eb23753df7581b2367893e92779a08b 100644 (file)
@@ -403,9 +403,15 @@ gst_net_time_provider_start (GstNetTimeProvider * self)
   gst_poll_add_fd (self->priv->fdset, &self->priv->sock);
   gst_poll_fd_ctl_read (self->priv->fdset, &self->priv->sock, TRUE);
 
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   self->thread = g_thread_create (gst_net_time_provider_thread, self, TRUE,
       &error);
-  if (!self->thread)
+#else
+  self->thread = g_thread_try_new ("GstNetTimeProvider",
+      gst_net_time_provider_thread, self, &error);
+#endif
+
+  if (error != NULL)
     goto no_thread;
 
   return TRUE;