hds: separate hds thread 21/41921/1
authorJinhyung Choi <jinhyung2.choi@samsung.com>
Mon, 8 Jun 2015 13:29:15 +0000 (22:29 +0900)
committerJinhyung Choi <jinhyung2.choi@samsung.com>
Fri, 19 Jun 2015 07:01:00 +0000 (16:01 +0900)
- send error message when pthread operation is failed

Change-Id: I1fd55289acd335bf40f461bc19b80fbebbe49864
Signed-off-by: Jinhyung Choi <jinhyung2.choi@samsung.com>
include/emuld.h
include/mobile.h
src/common.cpp

index 15b9b2c8714cc85364998884c3283d9dcfb5689e..699c34b1d7fa7bd69c0ea72ae23c3ef15e428480 100644 (file)
@@ -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];
index f2f32ac5e58a29a2abb63f7a3f8c6dfe46f4fe3f..f82e6cf7f91287e55e4d380811abe257a5a5773b 100644 (file)
@@ -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"
index 6bc9aa060047c1bb00b0050bcf5a62b3749ac37f..198dca17758849f5a97cf13ec1861950cb04da71 100644 (file)
@@ -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 {