From: Kyeonghun Lee Date: Wed, 1 Jun 2016 04:24:44 +0000 (+0900) Subject: resolve TSAM-4154: select starvation issue fixed X-Git-Tag: submit/tizen/20160603.061107~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe11eee16f1a744cac1ab76acc37c00f8c415158;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git resolve TSAM-4154: select starvation issue fixed Change-Id: Id3fccfdb735845b17d0d3bab7522ef458992e7fd Signed-off-by: Kyeonghun Lee --- diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index a2946b5..4e1a739 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -31,6 +31,10 @@ #include #include +typedef struct _msg_launch_app_data { + char *app_id; + bundle *bundle_data; +} msg_launch_app_data; #define DEFAULT_MIN_MATCH_DIGIT 8 @@ -1239,14 +1243,35 @@ uid_t msg_get_login_user() } +void* _msg_launch_app(void *data) +{ + if (data) { + msg_launch_app_data *ad = (msg_launch_app_data *)data; + int ret = aul_launch_app_for_uid(ad->app_id, ad->bundle_data, msg_get_login_user()); + if (ret <= 0) { + MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret); + } + + g_free(ad->app_id); + bundle_free(ad->bundle_data); + g_free(ad); + } + + return NULL; +} + msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data) { - int ret = aul_launch_app_for_uid(app_id, bundle_data, msg_get_login_user()); - if (ret <= 0) { - MSG_DEBUG("aul_launch_app_for_uid() is failed : %d", ret); - return MSG_ERR_UNKNOWN; + msg_launch_app_data *data = (msg_launch_app_data *)calloc(1, sizeof(msg_launch_app_data)); + data->app_id = g_strdup(app_id); + data->bundle_data = bundle_dup(bundle_data); + pthread_t thd; + + if (pthread_create(&thd, NULL, &_msg_launch_app, data) < 0) { + MSG_DEBUG("pthread_create() error"); } + pthread_detach(thd); return MSG_SUCCESS; }