aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-21 18:38:22 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-06-25 15:14:31 -0400
commit1e47db6a711a1f605bc765cb694d575af28ab85e (patch)
treedcf843487389b9c6a79273fc3a2bbae1a45fd67e
parenteina_thread_queue: use normal mempools for block allocation (diff)
downloadefl-1e47db6a711a1f605bc765cb694d575af28ab85e.tar.gz
ecore/thread: track "no_queue" threads
these threads are still managed by the main loop, meaning they must be accounted for so that they can be waited on if necessary during shutdown this resolves some issues where ecore-con threads would persist after the main thread had exited or called ecore_shutdown @fix fix https://phab.enlightenment.org/T7041 Differential Revision: https://phab.enlightenment.org/D6354
-rw-r--r--src/lib/ecore/ecore_thread.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c
index c8f76139fd..97de931aea 100644
--- a/src/lib/ecore/ecore_thread.c
+++ b/src/lib/ecore/ecore_thread.c
@@ -460,10 +460,13 @@ _ecore_direct_worker_cleanup(void *data)
DBG("cleanup work=%p, thread=%" PRIu64 " (should join)", work, (uint64_t)work->self);
+ SLKL(_ecore_pending_job_threads_mutex);
+ _ecore_thread_count--;
ecore_main_loop_thread_safe_call_async(_ecore_thread_handler, work);
ecore_main_loop_thread_safe_call_async((Ecore_Cb)_ecore_thread_join,
(void *)(intptr_t)PHS());
+ SLKU(_ecore_pending_job_threads_mutex);
}
static void *
@@ -686,7 +689,7 @@ ecore_thread_run(Ecore_Thread_Cb func_blocking,
SLKL(_ecore_pending_job_threads_mutex);
_ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work);
- if (_ecore_thread_count == _ecore_thread_count_max)
+ if (_ecore_thread_count >= _ecore_thread_count_max)
{
SLKU(_ecore_pending_job_threads_mutex);
return (Ecore_Thread *)work;
@@ -947,7 +950,12 @@ ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy,
retry_direct:
if (PHC(t, _ecore_direct_worker, worker))
- return (Ecore_Thread *)worker;
+ {
+ SLKL(_ecore_pending_job_threads_mutex);
+ _ecore_thread_count++;
+ SLKU(_ecore_pending_job_threads_mutex);
+ return (Ecore_Thread *)worker;
+ }
if (!tried)
{
_ecore_main_call_flush();
@@ -969,7 +977,7 @@ retry_direct:
SLKL(_ecore_pending_job_threads_mutex);
_ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, worker);
- if (_ecore_thread_count == _ecore_thread_count_max)
+ if (_ecore_thread_count >= _ecore_thread_count_max)
{
SLKU(_ecore_pending_job_threads_mutex);
return (Ecore_Thread *)worker;