cMain: seperate orchestration init and dbus running using pthread 56/204256/1
authordaeken.kwon <daeken.kwon@samsung.com>
Mon, 22 Apr 2019 09:58:22 +0000 (18:58 +0900)
committerdaeken.kwon <daeken.kwon@samsung.com>
Mon, 22 Apr 2019 09:58:22 +0000 (18:58 +0900)
Change-Id: I12048492c54a6f4ee7723a34aabecdaf08872c40

src/CMain/src/main.c

index a838242ba8cf89a59e8c83ca9fca4c88eb717fe8..73f38c08c5caf24b3a5bf89a65204acb1379a5b7 100644 (file)
@@ -19,6 +19,7 @@
 #include <gio/gio.h>
 #include <stdarg.h>
 #include <stdlib.h>
+#include <pthread.h>
 
 #include <orchestration_server.h>
 #include <orchestration.h>
@@ -34,14 +35,23 @@ void request_cb(char* app_name, char* service_info){
        }
 }
 
+void* thread_orchestration() {
+       DEBUG("Start OrchestrationInit Thread !!");
+       OrchestrationInit();
+       return NULL;
+}
+
 int main(void){
        int result;
+        pthread_t p_thread;
 
        GMainLoop *loop;
 
        /* DEBUG for log can be used after OrchestrationInit */
-       printf("OrchestrationInit call");
-       OrchestrationInit();
+       if (pthread_create(&p_thread, NULL, thread_orchestration, NULL) != 0) {
+               DEBUG("Fail to start OrchestrationInit Thread !!");
+               return -1;
+       }
 
        set_default_dbus_interface();
        DEBUG("orchestration_server_initialize call");
@@ -58,6 +68,7 @@ int main(void){
        g_main_loop_run (loop);
        orchestration_server_finish();
 
+
        return 0;
 }