From: Kyeonghun Lee Date: Tue, 14 Mar 2017 07:26:53 +0000 (+0900) Subject: [P170314-02250] give attribute with pthread_create() for launch app X-Git-Tag: submit/tizen/20170328.034237~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aba4bd93058b2249096445af7dabe5102c6de578;p=platform%2Fcore%2Fmessaging%2Fmsg-service.git [P170314-02250] give attribute with pthread_create() for launch app Change-Id: I67e294ad3bab6626237daaaef5298035a42e242a Signed-off-by: Kyeonghun Lee --- diff --git a/utils/MsgUtilFunction.cpp b/utils/MsgUtilFunction.cpp index 0174373..392e088 100755 --- a/utils/MsgUtilFunction.cpp +++ b/utils/MsgUtilFunction.cpp @@ -1295,12 +1295,26 @@ msg_error_t msg_launch_app(const char *app_id, bundle *bundle_data) data->app_id = g_strdup(app_id); data->bundle_data = bundle_dup(bundle_data); pthread_t thd; + pthread_attr_t attr; - if (pthread_create(&thd, NULL, &_msg_launch_app, data) < 0) { + if (pthread_attr_init(&attr) < 0) { + MSG_ERR("pthread_attr_init() error"); + return MSG_ERR_UNKNOWN; + } + + if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) < 0) { + MSG_ERR("pthread_attr_setdetachstate() error"); + return MSG_ERR_UNKNOWN; + } + + if (pthread_create(&thd, &attr, &_msg_launch_app, data) < 0) { MSG_ERR("pthread_create() error"); } - pthread_detach(thd); + if (pthread_attr_destroy(&attr) < 0) { + MSG_ERR("pthread_attr_destroy() error"); + } + return MSG_SUCCESS; }