Cancel lws_service before calling pthread_join 06/223306/2
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 28 Jan 2020 10:26:08 +0000 (19:26 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 28 Jan 2020 10:29:08 +0000 (19:29 +0900)
Change-Id: Ice5e929815541ef294841394dc00e10a2d4a4e5b

src/legacy_support/websocket.cpp

index 63eee08..3e218d7 100644 (file)
@@ -379,6 +379,7 @@ void *process_ws_server(void *data)
             LOGD("WARNING : g_ws_server_context is NULL");
         }
     }
+    LOGD("process_ws_server exits now");
     return NULL;
 }
 
@@ -499,6 +500,11 @@ bool CWebHelperAgentWebSocket::exit()
     on_exit();
 
     g_ws_server_exit = true;
+    if (g_ws_server_context) {
+        lws_cancel_service(g_ws_server_context);
+        lws_context_destroy(g_ws_server_context);
+        g_ws_server_context = NULL;
+    }
 
     if (m_message_pipe) {
         ecore_pipe_del(m_message_pipe);
@@ -514,12 +520,6 @@ bool CWebHelperAgentWebSocket::exit()
 
     pthread_mutex_destroy(&g_ws_server_mutex);
 
-    if (g_ws_server_context) {
-        lws_cancel_service(g_ws_server_context);
-        lws_context_destroy(g_ws_server_context);
-        g_ws_server_context = NULL;
-    }
-
     ecore_shutdown();
 
     return true;