summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyeonghun Lee <kh9090.lee@samsung.com>2017-03-14 16:26:53 +0900
committerKyeonghun Lee <kh9090.lee@samsung.com>2017-03-14 16:26:53 +0900
commitaba4bd93058b2249096445af7dabe5102c6de578 (patch)
tree28f6438e44a122d8152fbc5b9be966b2ab0619d0
parente1872b5cadd1f179e0f8d3158a0065d8921bf8e3 (diff)
downloadmsg-service-aba4bd93058b2249096445af7dabe5102c6de578.tar.gz
msg-service-aba4bd93058b2249096445af7dabe5102c6de578.tar.bz2
msg-service-aba4bd93058b2249096445af7dabe5102c6de578.zip
[P170314-02250] give attribute with pthread_create() for launch app
Change-Id: I67e294ad3bab6626237daaaef5298035a42e242a Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
-rwxr-xr-xutils/MsgUtilFunction.cpp18
1 files 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;
}