From aba4bd93058b2249096445af7dabe5102c6de578 Mon Sep 17 00:00:00 2001 From: Kyeonghun Lee Date: Tue, 14 Mar 2017 16:26:53 +0900 Subject: [PATCH] [P170314-02250] give attribute with pthread_create() for launch app Change-Id: I67e294ad3bab6626237daaaef5298035a42e242a Signed-off-by: Kyeonghun Lee --- utils/MsgUtilFunction.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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; } -- 2.34.1