From: Tim-Philipp Müller Date: Mon, 12 Dec 2011 02:38:37 +0000 (+0000) Subject: Use g_thread_try_new() instead of g_thread_crate() with newer glib versions X-Git-Tag: RELEASE-0.11.1~7^2~117 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=330d9842884e701822fd2644f179c0e4113074f5;p=platform%2Fupstream%2Fgst-plugins-good.git Use g_thread_try_new() instead of g_thread_crate() with newer glib versions --- diff --git a/ext/soup/gstsouphttpclientsink.c b/ext/soup/gstsouphttpclientsink.c index 5f3d47e..dc9e941 100644 --- a/ext/soup/gstsouphttpclientsink.c +++ b/ext/soup/gstsouphttpclientsink.c @@ -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); diff --git a/gst/rtpmanager/gstrtpsession.c b/gst/rtpmanager/gstrtpsession.c index 31f9a73..cf263e3 100644 --- a/gst/rtpmanager/gstrtpsession.c +++ b/gst/rtpmanager/gstrtpsession.c @@ -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); diff --git a/sys/oss4/oss4-mixer.c b/sys/oss4/oss4-mixer.c index 87f7ca6..03e2d9d 100644 --- a/sys/oss4/oss4-mixer.c +++ b/sys/oss4/oss4-mixer.c @@ -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); diff --git a/tests/icles/v4l2src-test.c b/tests/icles/v4l2src-test.c index 4fcf48b..dbcaef0 100644 --- a/tests/icles/v4l2src-test.c +++ b/tests/icles/v4l2src-test.c @@ -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; }