[P170314-02250] give attribute with pthread_create() for launch app 28/118828/1
authorKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 14 Mar 2017 07:26:53 +0000 (16:26 +0900)
committerKyeonghun Lee <kh9090.lee@samsung.com>
Tue, 14 Mar 2017 07:26:53 +0000 (16:26 +0900)
Change-Id: I67e294ad3bab6626237daaaef5298035a42e242a
Signed-off-by: Kyeonghun Lee <kh9090.lee@samsung.com>
utils/MsgUtilFunction.cpp

index 0174373..392e088 100755 (executable)
@@ -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;
 }