cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=8205051ff6a4911b387d5500d936d45b05c9d511

commit 8205051ff6a4911b387d5500d936d45b05c9d511
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Wed Dec 7 11:17:01 2016 -0800

    evas: wait on one specific task to be done.
    
    This prevent dead lock.
---
 src/lib/evas/cache/evas_cache_image.c | 4 +++-
 src/lib/evas/cache/evas_preload.c     | 7 +++++++
 src/lib/evas/include/evas_private.h   | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/cache/evas_cache_image.c 
b/src/lib/evas/cache/evas_cache_image.c
index 152cea6..9cf9e97 100644
--- a/src/lib/evas/cache/evas_cache_image.c
+++ b/src/lib/evas/cache/evas_cache_image.c
@@ -1197,13 +1197,15 @@ evas_cache_image_load_data(Image_Entry *im)
              evas_preload_thread_cancel(im->preload);
           }
         evas_async_events_process();
-        
+        evas_preload_pthread_wait(im->preload, 0.01);
+
         LKL(wakeup);
         while (im->flags.preload_pending)
           {
              eina_condition_wait(&cond_wakeup);
              LKU(wakeup);
              evas_async_events_process();
+             evas_preload_pthread_wait(im->preload, 0.01);
              LKL(wakeup);
           }
         LKU(wakeup);
diff --git a/src/lib/evas/cache/evas_preload.c 
b/src/lib/evas/cache/evas_preload.c
index 9ad2f35..f400a71 100644
--- a/src/lib/evas/cache/evas_preload.c
+++ b/src/lib/evas/cache/evas_preload.c
@@ -138,3 +138,10 @@ evas_preload_thread_cancelled_is(Evas_Preload_Pthread 
*work)
    if (!work) return EINA_FALSE;
    return ecore_thread_check(work->thread);
 }
+
+Eina_Bool
+evas_preload_pthread_wait(Evas_Preload_Pthread *work, double wait)
+{
+   if (!work) return EINA_TRUE;
+   return ecore_thread_wait(work->thread, wait);
+}
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 8e15337..26ea5c5 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1952,6 +1952,7 @@ Evas_Preload_Pthread *evas_preload_thread_run(void 
(*func_heavy)(void *data),
                                               const void *data);
 Eina_Bool evas_preload_thread_cancel(Evas_Preload_Pthread *thread);
 Eina_Bool evas_preload_thread_cancelled_is(Evas_Preload_Pthread *thread);
+Eina_Bool evas_preload_pthread_wait(Evas_Preload_Pthread *work, double wait);
 
 void _evas_walk(Evas_Public_Data *e_pd);
 void _evas_unwalk(Evas_Public_Data *e_pd);

-- 


Reply via email to