fix: refact mutex locking

This commit is contained in:
Minglei Jin 2022-08-18 18:57:49 +08:00
parent 45dc2ec1f2
commit 65903a7c0d
1 changed files with 5 additions and 6 deletions

View File

@ -1119,7 +1119,10 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
taosMemoryFree(pRow); taosMemoryFree(pRow);
} }
taosThreadMutexUnlock(&pTsdb->lruMutex);
*handle = NULL; *handle = NULL;
return 0; return 0;
} }
@ -1131,15 +1134,11 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
} }
taosThreadMutexUnlock(&pTsdb->lruMutex); taosThreadMutexUnlock(&pTsdb->lruMutex);
} else {
taosThreadMutexUnlock(&pTsdb->lruMutex);
*handle = h;
return code;
}
h = taosLRUCacheLookup(pCache, key, keyLen); h = taosLRUCacheLookup(pCache, key, keyLen);
} else {
taosThreadMutexUnlock(&pTsdb->lruMutex);
}
} }
*handle = h; *handle = h;