From 536276eee1d4a6903c80be0c39c6364d6264179b Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Wed, 12 Sep 2012 12:54:07 +0200 Subject: [PATCH] tests: port to the new GLib thread API --- tests/check/elements/audiotestsrc.c | 6 +++--- tests/check/elements/textoverlay.c | 15 +++++++++------ tests/check/elements/videotestsrc.c | 6 +++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/check/elements/audiotestsrc.c b/tests/check/elements/audiotestsrc.c index f938175..499bae3 100644 --- a/tests/check/elements/audiotestsrc.c +++ b/tests/check/elements/audiotestsrc.c @@ -93,10 +93,10 @@ GST_START_TEST (test_all_waves) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_mutex_lock (check_mutex); + g_mutex_lock (&check_mutex); while (g_list_length (buffers) < 10) - g_cond_wait (check_cond, check_mutex); - g_mutex_unlock (check_mutex); + g_cond_wait (&check_cond, &check_mutex); + g_mutex_unlock (&check_mutex); gst_element_set_state (audiotestsrc, GST_STATE_READY); diff --git a/tests/check/elements/textoverlay.c b/tests/check/elements/textoverlay.c index 446a9ba..fe06b42 100644 --- a/tests/check/elements/textoverlay.c +++ b/tests/check/elements/textoverlay.c @@ -585,9 +585,10 @@ GST_START_TEST (test_video_waits_for_text) * newsegment event to arrive); we spawn a background thread to send such * a newsegment event after a second or so so we get back control */ thread = - g_thread_create (test_video_waits_for_text_send_text_newsegment_thread, - NULL, FALSE, NULL); + g_thread_try_new ("gst-check", + test_video_waits_for_text_send_text_newsegment_thread, NULL, NULL); fail_unless (thread != NULL); + g_thread_unref (thread); GST_LOG ("pushing video buffer 3"); fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_OK); @@ -614,9 +615,10 @@ GST_START_TEST (test_video_waits_for_text) * text buffer (or a newsegment event) to arrive; we spawn a background * thread to shut down the element while it's waiting to make sure that * works ok */ - thread = g_thread_create (test_video_waits_for_text_shutdown_element, - textoverlay, FALSE, NULL); + thread = g_thread_try_new ("gst-check", + test_video_waits_for_text_shutdown_element, textoverlay, NULL); fail_unless (thread != NULL); + g_thread_unref (thread); GST_LOG ("pushing video buffer 4"); fail_unless (gst_pad_push (myvideosrcpad, inbuffer) == GST_FLOW_FLUSHING); @@ -681,9 +683,10 @@ GST_START_TEST (test_render_continuity) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - thread = g_thread_create (test_render_continuity_push_video_buffers_thread, - NULL, FALSE, NULL); + thread = g_thread_try_new ("gst-check", + test_render_continuity_push_video_buffers_thread, NULL, NULL); fail_unless (thread != NULL); + g_thread_unref (thread); caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING, "utf8", NULL); diff --git a/tests/check/elements/videotestsrc.c b/tests/check/elements/videotestsrc.c index 4cfe9a7..40fd369 100644 --- a/tests/check/elements/videotestsrc.c +++ b/tests/check/elements/videotestsrc.c @@ -100,12 +100,12 @@ GST_START_TEST (test_all_patterns) GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_mutex_lock (check_mutex); + g_mutex_lock (&check_mutex); while (g_list_length (buffers) < 10) { GST_DEBUG_OBJECT (videotestsrc, "Waiting for more buffers"); - g_cond_wait (check_cond, check_mutex); + g_cond_wait (&check_cond, &check_mutex); } - g_mutex_unlock (check_mutex); + g_mutex_unlock (&check_mutex); gst_element_set_state (videotestsrc, GST_STATE_READY); -- 2.7.4