mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
gsttaskpool: Do not block tasks while cleaning up the taskpool
There is a deadlock if any thread from the pool tries to push a new task while other thread is waiting for the pool of threads to finish. With this patch the thread will get an error when it tries to add a new task while the taskpool is being cleaned up.
This commit is contained in:
parent
b5286f0560
commit
706e10ad05
1 changed files with 8 additions and 4 deletions
|
@ -81,15 +81,19 @@ default_prepare (GstTaskPool * pool, GError ** error)
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue