From 19684058c18e0dad02c925a6462b54bb892d4847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=92=A6=E8=A1=97?= <15390014138@163.com> Date: Sun, 28 Mar 2021 19:23:32 +0800 Subject: [PATCH] update core/adapter/syscall/src/hdf_syscall_adapter.c. --- .../adapter/syscall/src/hdf_syscall_adapter.c | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/core/adapter/syscall/src/hdf_syscall_adapter.c b/core/adapter/syscall/src/hdf_syscall_adapter.c index cefcaa3e2..2848d39c7 100644 --- a/core/adapter/syscall/src/hdf_syscall_adapter.c +++ b/core/adapter/syscall/src/hdf_syscall_adapter.c @@ -209,6 +209,14 @@ static int32_t AssignPfds(struct HdfDevListenerThread *thread, struct pollfd **p return pfdCount; } +static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) +{ + OsalMutexDestroy(&thread->mutex); + OsalMemFree(thread->pfds); + OsalThreadDestroy(&thread->thread); + OsalMemFree(thread); +} + #define POLL_WAIT_TIME_MS 100 static int32_t HdfDevEventListenTask(void *para) { @@ -255,10 +263,7 @@ exit: if (thread->shouldStop) { /* exit due to async exit call, should free thread struct */ - OsalMutexDestroy(&thread->mutex); - OsalThreadDestroy(&thread->thread); - OsalMemFree(thread->pfds); - OsalMemFree(thread); + HdfDevListenerThreadFree(thread); } return HDF_SUCCESS; @@ -575,14 +580,6 @@ static void HdfListenThreadPollDel(struct HdfDevListenerThread *thread, struct OsalMutexUnlock(&thread->mutex); } -static void HdfDevListenerThreadFree(struct HdfDevListenerThread *thread) -{ - OsalMutexDestroy(&thread->mutex); - OsalMemFree(thread->pfds); - OsalThreadDestroy(&thread->thread); - OsalMemFree(thread); -} - static void HdfDevListenerThreadDestroy(struct HdfDevListenerThread *thread) { if (thread == NULL) { -- Gitee