From: Ji-hoon Lee Date: Mon, 7 Jan 2019 02:36:24 +0000 (+0900) Subject: Make server connection code to be executed in the main thread X-Git-Tag: submit/tizen/20190213.101901~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=67148eb3e4b472d0e5ecea55d9d84efabcc7704a;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Make server connection code to be executed in the main thread Change-Id: I989658fc931e2dfbca3d05c2e068ff91d439b13b --- diff --git a/client/ma.c b/client/ma.c index 5af0ad7..568e984 100644 --- a/client/ma.c +++ b/client/ma.c @@ -279,7 +279,7 @@ static Eina_Bool __ma_connect_daemon(void *data) SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to initialize"); ma_client_set_error(g_ma, MA_ERROR_ENGINE_NOT_FOUND); - ecore_main_loop_thread_safe_call_async(__ma_notify_error, (void*)g_ma); + __ma_notify_error(g_ma); return EINA_FALSE; //LCOV_EXCL_STOP @@ -287,7 +287,7 @@ static Eina_Bool __ma_connect_daemon(void *data) SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to initialize"); //LCOV_EXCL_LINE ma_client_set_error(g_ma, MA_ERROR_TIMED_OUT); - ecore_main_loop_thread_safe_call_async(__ma_notify_error, (void*)g_ma); + __ma_notify_error(g_ma); return EINA_TRUE; } else { @@ -296,7 +296,7 @@ static Eina_Bool __ma_connect_daemon(void *data) } ma_client_set_client_state(g_ma, MA_STATE_READY); - ecore_main_loop_thread_safe_call_async(__ma_notify_state_changed, (void*)g_ma); + __ma_notify_state_changed(g_ma); ma_client_set_ui_pid(g_ma, ui_pid); } else { @@ -307,9 +307,9 @@ static Eina_Bool __ma_connect_daemon(void *data) return EINA_FALSE; } -static void __start_prepare_thread(void *data, Ecore_Thread *thread) +static void __start_prepare_func() { - SLOG(LOG_ERROR, TAG_MAC, "[DEBUG] Start prepare thread"); + SLOG(LOG_ERROR, TAG_MAC, "[DEBUG] Start prepare func"); int ret = -1; int retry_count = 0; @@ -348,9 +348,9 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) return; } -static void __end_prepare_thread(void *data, Ecore_Thread *thread) +static void __end_prepare_func() { - SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] End prepare thread"); + SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] End prepare func"); } int ma_prepare(void) @@ -378,7 +378,8 @@ int ma_prepare(void) return MA_ERROR_INVALID_STATE; } - ecore_thread_run(__start_prepare_thread, __end_prepare_thread, NULL, NULL); + __start_prepare_func(); + __end_prepare_func(); return MA_ERROR_NONE; } @@ -412,7 +413,7 @@ int ma_unprepare(void) __ma_internal_unprepare(); ma_client_set_client_state(g_ma, MA_STATE_INITIALIZED); - ecore_main_loop_thread_safe_call_async(__ma_notify_state_changed, (void*)g_ma); + __ma_notify_state_changed((void*)g_ma); return MA_ERROR_NONE; } @@ -482,7 +483,7 @@ int __ma_cb_error(int reason, char* msg) SLOG(LOG_ERROR, TAG_MAC, "[ERROR] multi-assistant service reset"); ma_client_set_client_state(g_ma, MA_STATE_INITIALIZED); - ecore_main_loop_thread_safe_call_async(__ma_notify_state_changed, (void*)g_ma); + __ma_notify_state_changed((void*)g_ma); if (0 != ma_prepare()) { SLOG(LOG_ERROR, TAG_MAC, "[ERROR] Fail to prepare"); @@ -492,7 +493,7 @@ int __ma_cb_error(int reason, char* msg) SLOG(LOG_DEBUG, TAG_MAC, "[DEBUG] Error reason(%d), msg(%s)", reason, msg); ma_client_set_error(g_ma, reason); - ecore_main_loop_thread_safe_call_async(__ma_notify_error, (void*)g_ma); + __ma_notify_error((void*)g_ma); return MA_ERROR_NONE; }