From b25d5dffa8af2979eb9a9c1835224a4f3c476f3e Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 4 Aug 2016 19:25:18 +0900 Subject: [PATCH] lib: thread optimization. get out of threads if they are canceled. threads don't need to perform their logic totally. --- src/lib/auto_comp.c | 4 +++- src/lib/edc_parser.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c index 9fa5117..bd1e159 100644 --- a/src/lib/auto_comp.c +++ b/src/lib/auto_comp.c @@ -125,7 +125,7 @@ lexem_tree_free(lexem **root) } static void -context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED) +context_lexem_thread_cb(void *data, Ecore_Thread *thread) { const int quot_len = QUOT_UTF8_LEN; @@ -163,6 +163,8 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED) while (cur && cur <= end) { + if (ecore_thread_check(thread)) break; + //Check inside quote if ((cur != end) && (!strncmp(cur, quot, quot_len))) { diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c index 671c34c..3823796 100644 --- a/src/lib/edc_parser.c +++ b/src/lib/edc_parser.c @@ -70,7 +70,7 @@ struct parser_s /*****************************************************************************/ static void -cur_context_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) +cur_context_thread_blocking(void *data, Ecore_Thread *thread) { #define PART_SYNTAX_CNT 14 @@ -122,6 +122,8 @@ cur_context_thread_blocking(void *data, Ecore_Thread *thread EINA_UNUSED) while (p && p <= end) { + if (ecore_thread_check(thread)) break; + //Skip "" range if (!strncmp(p, QUOT_UTF8, QUOT_UTF8_LEN)) {