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;
}