X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fcheck%2Fgst%2Fgsttask.c;h=699219f4ae19a1fb9583cacba7d503d360cf258b;hb=76e8b2ecdad9f5e09c2c9b32f0c679a8b6638431;hp=9cfe206ff367d932ada4e398c7e1ff30c05997c9;hpb=64086e2970fc456258900ec952b925f3b96be7ca;p=platform%2Fupstream%2Fgstreamer.git diff --git a/tests/check/gst/gsttask.c b/tests/check/gst/gsttask.c index 9cfe206..699219f 100644 --- a/tests/check/gst/gsttask.c +++ b/tests/check/gst/gsttask.c @@ -1,7 +1,7 @@ /* GStreamer * Copyright (C) 2005 Thomas Vander Stichele * - * gstelement.c: Unit test for GstElement + * gsttask.c: Unit test for GstTask * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,10 +21,10 @@ #include -static GMutex *task_lock; -static GCond *task_cond; +static GMutex task_lock; +static GCond task_cond; -static GStaticRecMutex task_mutex = G_STATIC_REC_MUTEX_INIT; +static GRecMutex task_mutex; static void task_func2 (void *data) @@ -32,10 +32,10 @@ task_func2 (void *data) gboolean ret; GstTask *t = *((GstTask **) data); - g_mutex_lock (task_lock); + g_mutex_lock (&task_lock); GST_DEBUG ("signal"); - g_cond_signal (task_cond); - g_mutex_unlock (task_lock); + g_cond_signal (&task_cond); + g_mutex_unlock (&task_lock); ASSERT_WARNING (ret = gst_task_join (t)); fail_unless (ret == FALSE); @@ -46,28 +46,31 @@ GST_START_TEST (test_join) GstTask *t; gboolean ret; - t = gst_task_create (task_func2, &t); + t = gst_task_new (task_func2, &t, NULL); fail_if (t == NULL); + g_rec_mutex_init (&task_mutex); gst_task_set_lock (t, &task_mutex); - task_cond = g_cond_new (); - task_lock = g_mutex_new (); + g_cond_init (&task_cond); + g_mutex_init (&task_lock); - g_mutex_lock (task_lock); + g_mutex_lock (&task_lock); GST_DEBUG ("starting"); ret = gst_task_start (t); fail_unless (ret == TRUE); /* wait for it to spin up */ GST_DEBUG ("waiting"); - g_cond_wait (task_cond, task_lock); + g_cond_wait (&task_cond, &task_lock); GST_DEBUG ("done waiting"); - g_mutex_unlock (task_lock); + g_mutex_unlock (&task_lock); GST_DEBUG ("joining"); ret = gst_task_join (t); fail_unless (ret == TRUE); + gst_task_cleanup_all (); + gst_object_unref (t); } @@ -76,10 +79,10 @@ GST_END_TEST; static void task_func (void *data) { - g_mutex_lock (task_lock); + g_mutex_lock (&task_lock); GST_DEBUG ("signal"); - g_cond_signal (task_cond); - g_mutex_unlock (task_lock); + g_cond_signal (&task_cond); + g_mutex_unlock (&task_lock); } GST_START_TEST (test_lock_start) @@ -87,23 +90,24 @@ GST_START_TEST (test_lock_start) GstTask *t; gboolean ret; - t = gst_task_create (task_func, NULL); + t = gst_task_new (task_func, NULL, NULL); fail_if (t == NULL); + g_rec_mutex_init (&task_mutex); gst_task_set_lock (t, &task_mutex); - task_cond = g_cond_new (); - task_lock = g_mutex_new (); + g_cond_init (&task_cond); + g_mutex_init (&task_lock); - g_mutex_lock (task_lock); + g_mutex_lock (&task_lock); GST_DEBUG ("starting"); ret = gst_task_start (t); fail_unless (ret == TRUE); /* wait for it to spin up */ GST_DEBUG ("waiting"); - g_cond_wait (task_cond, task_lock); + g_cond_wait (&task_cond, &task_lock); GST_DEBUG ("done waiting"); - g_mutex_unlock (task_lock); + g_mutex_unlock (&task_lock); /* cannot set mutex now */ ASSERT_WARNING (gst_task_set_lock (t, &task_mutex)); @@ -112,6 +116,8 @@ GST_START_TEST (test_lock_start) ret = gst_task_join (t); fail_unless (ret == TRUE); + gst_task_cleanup_all (); + gst_object_unref (t); } @@ -122,9 +128,10 @@ GST_START_TEST (test_lock) GstTask *t; gboolean ret; - t = gst_task_create (task_func, NULL); + t = gst_task_new (task_func, NULL, NULL); fail_if (t == NULL); + g_rec_mutex_init (&task_mutex); gst_task_set_lock (t, &task_mutex); GST_DEBUG ("pause"); @@ -149,7 +156,7 @@ GST_START_TEST (test_no_lock) GstTask *t; gboolean ret; - t = gst_task_create (task_func, NULL); + t = gst_task_new (task_func, NULL, NULL); fail_if (t == NULL); /* stop should be possible without lock */ @@ -175,7 +182,7 @@ GST_START_TEST (test_create) { GstTask *t; - t = gst_task_create (task_func, NULL); + t = gst_task_new (task_func, NULL, NULL); fail_if (t == NULL); gst_object_unref (t); @@ -184,7 +191,7 @@ GST_START_TEST (test_create) GST_END_TEST; -Suite * +static Suite * gst_task_suite (void) { Suite *s = suite_create ("GstTask");