bootstrap: remove unnecessary mainloop and thread. 81/261481/1
authorHosang Kim <hosang12.kim@samsung.com>
Tue, 20 Jul 2021 03:43:26 +0000 (12:43 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Tue, 20 Jul 2021 03:43:26 +0000 (12:43 +0900)
There is problem of CPU usage.
Unnecessary mainloop and thread make its problem.

Change-Id: Ib892b611ed087bcf37dc4066dde77b3d04a4b96e

org.tizen.aurum-bootstrap/src/BootstrapServer.cc

index 7255afd..0ae861e 100644 (file)
 using namespace grpc;
 
 typedef struct _ServiceContext {
-    GMainLoop *loop;
-    GThread *thread;
     std::unique_ptr<Server> server;
 } ServiceContext;
 
-static gpointer
-_grpc_thread_func (gpointer data)
+static bool _service_app_create(void *data)
 {
     ServiceContext *ctx = (ServiceContext *)data;
     std::string binding("0.0.0.0:50051");
@@ -33,16 +30,6 @@ _grpc_thread_func (gpointer data)
     ctx->server = std::move(builder.BuildAndStart());
     ctx->server->Wait();
 
-    return NULL;
-}
-
-static bool _service_app_create(void *data)
-{
-    ServiceContext *ctx = (ServiceContext *)data;
-
-    ctx->loop = g_main_loop_new ( NULL , FALSE );
-    ctx->thread = g_thread_new("grpc_thread", _grpc_thread_func, ctx);
-
     return true;
 }
 
@@ -50,8 +37,6 @@ static void _service_app_terminate(void *data)
 {
     ServiceContext *ctx = (ServiceContext *)data;
     ctx->server->Shutdown();
-    g_main_loop_unref(ctx->loop);
-    g_thread_join(ctx->thread);
 }
 
 static void _service_app_control(app_control_h app_control, void *data)