[gimp/gimp-2-10] app: in gimp-parallel, fix async-thread shutdown
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: in gimp-parallel, fix async-thread shutdown
- Date: Wed, 4 Jul 2018 18:11:00 +0000 (UTC)
commit d20170ed6ca2bb62af6e5a71578f0501a5455471
Author: Ell <ell_se yahoo com>
Date: Sun Jul 1 13:28:06 2018 -0400
app: in gimp-parallel, fix async-thread shutdown
... to prevent a potential deadlock.
(cherry picked from commit ff679c66a10828c0adc107dfb14b65ef334b5ffe)
app/core/gimp-parallel.cc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimp-parallel.cc b/app/core/gimp-parallel.cc
index 19c917595d..12fb3765c2 100644
--- a/app/core/gimp-parallel.cc
+++ b/app/core/gimp-parallel.cc
@@ -454,6 +454,7 @@ gimp_parallel_run_async_set_n_threads (gint n_threads)
gimp_parallel_run_async_n_threads = n_threads;
}
+
static gpointer
gimp_parallel_run_async_thread_func (GimpParallelRunAsyncThread *thread)
{
@@ -463,10 +464,10 @@ gimp_parallel_run_async_thread_func (GimpParallelRunAsyncThread *thread)
{
GimpParallelRunAsyncTask *task;
- if (thread->quit)
- break;
-
- while ((task = (GimpParallelRunAsyncTask *) g_queue_pop_head (&gimp_parallel_run_async_queue)))
+ while (! thread->quit &&
+ (task =
+ (GimpParallelRunAsyncTask *) g_queue_pop_head (
+ &gimp_parallel_run_async_queue)))
{
g_object_set_data (G_OBJECT (task->async),
"gimp-parallel-run-async-link", NULL);
@@ -478,6 +479,9 @@ gimp_parallel_run_async_thread_func (GimpParallelRunAsyncThread *thread)
g_mutex_lock (&gimp_parallel_run_async_mutex);
}
+ if (thread->quit)
+ break;
+
g_cond_wait (&gimp_parallel_run_async_cond,
&gimp_parallel_run_async_mutex);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]