From: Jinhyung Choi Date: Mon, 8 Jun 2015 13:29:15 +0000 (+0900) Subject: hds: separate hds thread X-Git-Tag: submit/tizen/20151105.051558~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=300ada4b47e89fb957d98df9c26239e2a270927d;p=platform%2Fadaptation%2Femulator%2Femulator-daemon.git hds: separate hds thread - send error message when pthread operation is failed Change-Id: I1fd55289acd335bf40f461bc19b80fbebbe49864 Signed-off-by: Jinhyung Choi --- diff --git a/include/emuld.h b/include/emuld.h index 15b9b2c..699c34b 100644 --- a/include/emuld.h +++ b/include/emuld.h @@ -62,12 +62,13 @@ enum #define HEADER_SIZE 4 #define STATUS 15 -// Thread TID profile uses >= 5 #define TID_BOOT 1 #define TID_SDCARD 2 #define TID_LOCATION 3 -#define TID_HDS 4 -#define TID_VCONF 6 +#define TID_HDS_ATTACH 4 +#define TID_HDS_DETACH 5 +#define TID_SENSOR 6 +#define TID_VCONF 7 extern pthread_t tid[MAX_CLIENT + 1]; extern int g_fd[fdtype_max]; diff --git a/include/mobile.h b/include/mobile.h index f2f32ac..f82e6cf 100644 --- a/include/mobile.h +++ b/include/mobile.h @@ -30,8 +30,6 @@ #ifndef __MOBILE_H__ #define __MOBILE_H__ -#define TID_SENSOR 5 - #define IJTYPE_SENSOR "sensor" #define VCONF_DBTAP "memory/private/sensor/800004" diff --git a/src/common.cpp b/src/common.cpp index 6bc9aa0..198dca1 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1473,6 +1473,8 @@ static void* umount_hds(void* args) void msgproc_hds(ijcommand* ijcmd) { char* data; + char* tag; + char* path; LOGDEBUG("msgproc_hds"); if (!strncmp(ijcmd->data, HDS_DEFAULT_PATH, 9)) { @@ -1489,14 +1491,25 @@ void msgproc_hds(ijcommand* ijcmd) LOGINFO("action: %d, data: %s", ijcmd->msg.action, data); if (ijcmd->msg.action == 1) { - if (pthread_create(&tid[TID_HDS], NULL, mount_hds, (void*)data) != 0) { + if (pthread_create(&tid[TID_HDS_ATTACH], NULL, mount_hds, (void*)data) != 0) { + if (!get_tag_path(data, &tag, &path)) { + LOGERR("mount pthread_create fail - wrong tag or path."); + free(data); + return; + } LOGERR("mount hds pthread create fail!"); + send_to_ecs(IJTYPE_HDS, MSG_GROUP_HDS, 2, tag); free(data); } } else if (ijcmd->msg.action == 2) { - pthread_cancel(tid[TID_HDS]); - if (pthread_create(&tid[TID_HDS], NULL, umount_hds, (void*)data) != 0) { + if (pthread_create(&tid[TID_HDS_DETACH], NULL, umount_hds, (void*)data) != 0) { + if (!get_tag_path(data, &tag, &path)) { + LOGERR("umount pthread_create fail - wrong tag or path."); + free(data); + return; + } LOGERR("umount hds pthread create fail!"); + send_to_ecs(IJTYPE_HDS, MSG_GROUP_HDS, 4, tag); free(data); } } else {