Use g_thread_try_new() instead of g_thread_crate() with newer glib versions
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 12 Dec 2011 02:38:37 +0000 (02:38 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Mon, 12 Dec 2011 09:46:27 +0000 (09:46 +0000)
ext/soup/gstsouphttpclientsink.c
gst/rtpmanager/gstrtpsession.c
sys/oss4/oss4-mixer.c
tests/icles/v4l2src-test.c

index 5f3d47e..dc9e941 100644 (file)
@@ -504,8 +504,14 @@ gst_soup_http_client_sink_start (GstBaseSink * sink)
 
     g_mutex_lock (souphttpsink->mutex);
 
+    /* FIXME: error handling */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
     souphttpsink->thread = g_thread_create (thread_func, souphttpsink,
         TRUE, &error);
+#else
+    souphttpsink->thread = g_thread_try_new ("souphttpclientsink-thread",
+        thread_func, souphttpsink, &error);
+#endif
 
     GST_LOG_OBJECT (souphttpsink, "waiting for main loop thread to start up");
     g_cond_wait (souphttpsink->cond, souphttpsink->mutex);
index 31f9a73..cf263e3 100644 (file)
@@ -910,8 +910,13 @@ start_rtcp_thread (GstRtpSession * rtpsession)
       g_thread_join (rtpsession->priv->thread);
     /* only create a new thread if the old one was stopped. Otherwise we can
      * just reuse the currently running one. */
+#if !GLIB_CHECK_VERSION (2, 31, 0)
     rtpsession->priv->thread =
         g_thread_create ((GThreadFunc) rtcp_thread, rtpsession, TRUE, &error);
+#else
+    rtpsession->priv->thread = g_thread_try_new ("rtpsession-rtcp-thread",
+        (GThreadFunc) rtcp_thread, rtpsession, &error);
+#endif
     rtpsession->priv->thread_stopped = FALSE;
   }
   GST_RTP_SESSION_UNLOCK (rtpsession);
index 87f7ca6..03e2d9d 100644 (file)
@@ -542,8 +542,13 @@ gst_oss4_mixer_start_watch_task (GstOss4Mixer * mixer)
   mixer->watch_cond = g_cond_new ();
   mixer->watch_shutdown = FALSE;
 
+#if !GLIB_CHECK_VERSION (2, 31, 0)
   mixer->watch_thread = g_thread_create (gst_oss4_mixer_watch_thread,
       gst_object_ref (mixer), TRUE, &err);
+#else
+  mixer->watch_thread = g_thread_try_new ("oss4-mixer-thread",
+      gst_oss4_mixer_watch_thread, gst_object_ref (mixer), &err);
+#endif
 
   if (mixer->watch_thread == NULL) {
     GST_ERROR_OBJECT (mixer, "Could not create watch thread: %s", err->message);
index 4fcf48b..dbcaef0 100644 (file)
@@ -491,7 +491,13 @@ main (int argc, char *argv[])
   gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
   loop = g_main_loop_new (NULL, FALSE);
 
-  if (!(input_thread = g_thread_create (read_user, source, TRUE, NULL))) {
+#if !GLIB_CHECK_VERSION (2, 31, 0)
+  input_thread = g_thread_create (read_user, source, TRUE, NULL);
+#else
+  input_thread = g_thread_try_new ("v4l2src-test", read_user, source, NULL);
+#endif
+
+  if (input_thread == NULL) {
     fprintf (stderr, "error: g_thread_create return NULL");
     return -1;
   }