X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgsttaskpool.c;h=89c8905e5f2fb102a2f1244b985d636739f43587;hb=cc6342d853f4252c5d5cf09fff9d3379ad467fbc;hp=8344d9ad81fc44747cf04a4af34b4f9d399efa54;hpb=39664da1f07bda3032ea867fc695450b689b9d8f;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gsttaskpool.c b/gst/gsttaskpool.c index 8344d9a..89c8905 100644 --- a/gst/gsttaskpool.c +++ b/gst/gsttaskpool.c @@ -35,6 +35,7 @@ #include "gstinfo.h" #include "gsttaskpool.h" +#include "gsterror.h" GST_DEBUG_CATEGORY_STATIC (taskpool_debug); #define GST_CAT_DEFAULT (taskpool_debug) @@ -73,22 +74,26 @@ static void default_prepare (GstTaskPool * pool, GError ** error) { GST_OBJECT_LOCK (pool); - pool->pool = g_thread_pool_new ((GFunc) default_func, pool, -1, FALSE, NULL); + pool->pool = g_thread_pool_new ((GFunc) default_func, pool, -1, FALSE, error); GST_OBJECT_UNLOCK (pool); } static void default_cleanup (GstTaskPool * pool) { + GThreadPool *pool_; + GST_OBJECT_LOCK (pool); - if (pool->pool) { + pool_ = pool->pool; + pool->pool = NULL; + GST_OBJECT_UNLOCK (pool); + + if (pool_) { /* Shut down all the threads, we still process the ones scheduled * because the unref happens in the thread function. * Also wait for currently running ones to finish. */ - g_thread_pool_free (pool->pool, FALSE, TRUE); - pool->pool = NULL; + g_thread_pool_free (pool_, FALSE, TRUE); } - GST_OBJECT_UNLOCK (pool); } static gpointer @@ -106,6 +111,9 @@ default_push (GstTaskPool * pool, GstTaskPoolFunction func, g_thread_pool_push (pool->pool, tdata, error); else { g_slice_free (TaskData, tdata); + g_set_error_literal (error, GST_CORE_ERROR, GST_CORE_ERROR_FAILED, + "No thread pool"); + } GST_OBJECT_UNLOCK (pool);