From 8d7cb8f0c29963df332629f785c7966968144b49 Mon Sep 17 00:00:00 2001 From: afwerar <1296468573@qq.com> Date: Sat, 21 Aug 2021 21:25:56 +0800 Subject: [PATCH] [TD-6169]: windows dll client can not quit. --- src/client/src/tscSystem.c | 3 --- src/util/src/tcache.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 8c8afc8d88..c04765b065 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -199,10 +199,7 @@ void taos_init_imp(void) { // In the APIs of other program language, taos_cleanup is not available yet. // So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning. - // But in the dll, the child thread will be killed before atexit takes effect.So taos_cleanup is not necessary. -#if !defined(TD_WINDOWS) atexit(taos_cleanup); -#endif tscDebug("client is initialized successfully"); } diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 69b3741e13..aaa1d5ba9e 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -537,7 +537,8 @@ void taosCacheCleanup(SCacheObj *pCacheObj) { pCacheObj->deleting = 1; // wait for the refresh thread quit before destroying the cache object. - while(atomic_load_8(&pCacheObj->deleting) != 0) { + // But in the dll, the child thread will be killed before atexit takes effect.So here we only wait for one second. + for (int i = 0; i < 20&&atomic_load_8(&pCacheObj->deleting) != 0; i++) { taosMsleep(50); } -- GitLab