From: jiin.moon Date: Mon, 29 Feb 2016 07:24:10 +0000 (+0900) Subject: evas: fix preload thread dead lock issue X-Git-Tag: accepted/tizen/common/20160408.184957~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=413e385b5383fc87bf51d8700c9fb759b37778b0;p=platform%2Fupstream%2Fefl.git evas: fix preload thread dead lock issue Summary: Add spin lock to access to new flag can check to status of the preload Reviewers: jpeg, cedric, jypark Subscribers: raster Differential Revision: https://phab.enlightenment.org/D3775 Signed-off-by: Cedric Bail evas: fix preload thread deadlock issue Summary: Wrong condition makes deadlock issue. Reviewers: jpeg, jypark Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3742 Signed-off-by: Cedric BAIL Change-Id: I8fc9fa60c574c6dbfb6c3073925da867408cdb95 --- diff --git a/src/lib/evas/cache/evas_cache_image.c b/src/lib/evas/cache/evas_cache_image.c index e1f8c69..2175dee 100644 --- a/src/lib/evas/cache/evas_cache_image.c +++ b/src/lib/evas/cache/evas_cache_image.c @@ -374,6 +374,10 @@ _evas_cache_image_async_heavy(void *data) } SLKU(current->lock_cancel); SLKU(current->lock); + + LKL(wakeup); + current->flags.preload_pending = 0; + LKU(wakeup); } static void @@ -388,6 +392,11 @@ _evas_cache_image_async_end(void *data) ie->preload = NULL; ie->flags.preload_done = ie->flags.loaded; ie->flags.updated_data = 1; + + LKL(wakeup); + ie->flags.preload_pending = 0; + LKU(wakeup); + while ((tmp = ie->targets)) { evas_object_inform_call_image_preloaded((Evas_Object*) tmp->target); @@ -409,6 +418,11 @@ _evas_cache_image_async_cancel(void *data) ie->preload = NULL; ie->cache->pending = eina_list_remove(ie->cache->pending, ie); + + LKL(wakeup); + ie->flags.preload_pending = 0; + LKU(wakeup); + if ((ie->flags.delete_me) || (ie->flags.dirty)) { ie->flags.delete_me = 0; @@ -466,6 +480,9 @@ _evas_cache_image_entry_preload_add(Image_Entry *ie, const Eo *target, { ie->cache->preload = eina_list_append(ie->cache->preload, ie); ie->flags.pending = 0; + LKL(wakeup); + ie->flags.preload_pending = 1; + LKU(wakeup); ie->preload = evas_preload_thread_run(_evas_cache_image_async_heavy, _evas_cache_image_async_end, _evas_cache_image_async_cancel, @@ -1158,9 +1175,9 @@ evas_cache_image_load_data(Image_Entry *im) evas_preload_thread_cancel(im->preload); } evas_async_events_process(); - + LKL(wakeup); - while (im->preload) + while (im->flags.preload_pending) { eina_condition_wait(&cond_wakeup); LKU(wakeup); diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h index addf056..efd9568 100644 --- a/src/lib/evas/include/evas_common_private.h +++ b/src/lib/evas/include/evas_common_private.h @@ -567,6 +567,7 @@ struct _Image_Entry_Flags Eina_Bool updated_data : 1; Eina_Bool flipped : 1; Eina_Bool textured : 1; + Eina_Bool preload_pending : 1; }; struct _Image_Entry_Frame