From a8b7c1e512ead98df83c3180f829d368f93e5609 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 14 Nov 2020 16:35:23 +0000 Subject: [PATCH] [TD-1785]: taos_close may fail --- src/rpc/src/rpcTcp.c | 2 +- src/sync/src/taosTcpPool.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 5758a7c226..affddf0520 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -173,11 +173,11 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread static void taosStopTcpThread(SThreadObj* pThreadObj) { // save thread into local variable and signal thread to stop pthread_t thread = pThreadObj->thread; + pThreadObj->stop = true; if (taosComparePthread(thread, pthread_self())) { pthread_detach(pthread_self()); return; } - pThreadObj->stop = true; pthread_join(thread, NULL); } diff --git a/src/sync/src/taosTcpPool.c b/src/sync/src/taosTcpPool.c index 1784dc60b7..3be2989342 100644 --- a/src/sync/src/taosTcpPool.c +++ b/src/sync/src/taosTcpPool.c @@ -302,10 +302,10 @@ static SThreadObj *taosGetTcpThread(SPoolObj *pPool) { static void taosStopPoolThread(SThreadObj *pThread) { pthread_t thread = pThread->thread; + pThread->stop = true; if (taosComparePthread(thread, pthread_self())) { pthread_detach(pthread_self()); return; } - pThread->stop = true; pthread_join(thread, NULL); } -- GitLab