From 490e855aabd16bee75e81477c46d84329bd46fd5 Mon Sep 17 00:00:00 2001 From: cheng_jinsong Date: Tue, 20 Sep 2022 18:46:52 -0700 Subject: [PATCH] pick up close interface from runloop Signed-off-by: cheng_jinsong Change-Id: I08eaa55f71f5e9c407f3d2c9817b86326e03abd5 --- interfaces/innerkits/control_fd/control_fd_client.c | 1 + services/loopevent/include/loop_event.h | 1 + services/loopevent/loop/le_epoll.c | 1 - services/loopevent/loop/le_loop.c | 6 ++++++ test/moduletest/param_test_cmds.c | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/interfaces/innerkits/control_fd/control_fd_client.c b/interfaces/innerkits/control_fd/control_fd_client.c index 7011d9a9..dd182277 100644 --- a/interfaces/innerkits/control_fd/control_fd_client.c +++ b/interfaces/innerkits/control_fd/control_fd_client.c @@ -198,5 +198,6 @@ void CmdClientInit(const char *socketPath, uint16_t type, const char *cmd) return; } LE_RunLoop(LE_GetDefaultLoop()); + LE_CloseLoop(LE_GetDefaultLoop()); BEGET_LOGI("Cmd Client exit "); } diff --git a/services/loopevent/include/loop_event.h b/services/loopevent/include/loop_event.h index ae1b5346..7ad8c7f9 100644 --- a/services/loopevent/include/loop_event.h +++ b/services/loopevent/include/loop_event.h @@ -66,6 +66,7 @@ typedef void *BufferHandle; LoopHandle LE_GetDefaultLoop(void); LE_STATUS LE_CreateLoop(LoopHandle *loopHandle); void LE_RunLoop(const LoopHandle loopHandle); +void LE_CloseLoop(const LoopHandle loopHandle); void LE_StopLoop(const LoopHandle loopHandle); void LE_CloseTask(const LoopHandle loopHandle, const TaskHandle taskHandle); diff --git a/services/loopevent/loop/le_epoll.c b/services/loopevent/loop/le_epoll.c index b5d94030..53c80a91 100644 --- a/services/loopevent/loop/le_epoll.c +++ b/services/loopevent/loop/le_epoll.c @@ -115,7 +115,6 @@ static LE_STATUS RunLoop_(const EventLoop *loop) break; } } - CloseLoop((EventLoop *)loop); return LE_SUCCESS; } diff --git a/services/loopevent/loop/le_loop.c b/services/loopevent/loop/le_loop.c index 401cc969..d5033be0 100644 --- a/services/loopevent/loop/le_loop.c +++ b/services/loopevent/loop/le_loop.c @@ -152,6 +152,12 @@ void LE_RunLoop(const LoopHandle handle) loop->runLoop(loop); } +void LE_CloseLoop(const LoopHandle loopHandle) +{ + LE_CHECK(loopHandle != NULL, return, "Invalid handle"); + CloseLoop((EventLoop *)loopHandle); +} + void LE_StopLoop(const LoopHandle handle) { LE_CHECK(handle != NULL, return, "Invalid handle"); diff --git a/test/moduletest/param_test_cmds.c b/test/moduletest/param_test_cmds.c index a61f76f9..d1a1bc28 100644 --- a/test/moduletest/param_test_cmds.c +++ b/test/moduletest/param_test_cmds.c @@ -135,6 +135,7 @@ static int32_t BShellParamCmdGroupTest(BShellHandle shell, int32_t argc, char *a PLUGIN_LOGI("group-test-stage3: wait service %s", argv[2]); // 2 service name index ServiceWatchForStatus(argv[2], ServiceStatusChangeTest); // 2 service name index LE_RunLoop(LE_GetDefaultLoop()); + LE_CloseLoop(LE_GetDefaultLoop()); } return 0; } -- GitLab