fix: log thread quit issue

This commit is contained in:
dapan1121 2023-04-24 19:29:33 +08:00
parent 9551a269b3
commit 28bff83096
1 changed files with 5 additions and 4 deletions

View File

@ -201,6 +201,11 @@ static void taosStopLog() {
void taosCloseLog() { void taosCloseLog() {
taosStopLog(); taosStopLog();
if (tsLogObj.logHandle != NULL && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL);
taosThreadClear(&tsLogObj.logHandle->asyncThread);
}
if (tsLogObj.slowHandle != NULL) { if (tsLogObj.slowHandle != NULL) {
taosThreadMutexDestroy(&tsLogObj.slowHandle->buffMutex); taosThreadMutexDestroy(&tsLogObj.slowHandle->buffMutex);
taosCloseFile(&tsLogObj.slowHandle->pFile); taosCloseFile(&tsLogObj.slowHandle->pFile);
@ -209,10 +214,6 @@ void taosCloseLog() {
} }
if (tsLogObj.logHandle != NULL) { if (tsLogObj.logHandle != NULL) {
if (tsLogObj.logHandle != NULL && taosCheckPthreadValid(tsLogObj.logHandle->asyncThread)) {
taosThreadJoin(tsLogObj.logHandle->asyncThread, NULL);
taosThreadClear(&tsLogObj.logHandle->asyncThread);
}
tsLogInited = 0; tsLogInited = 0;
taosThreadMutexDestroy(&tsLogObj.logHandle->buffMutex); taosThreadMutexDestroy(&tsLogObj.logHandle->buffMutex);