提交 289ede04 编写于 作者: Y yihaoDeng

handle conflict

上级 b740129f
...@@ -181,6 +181,8 @@ void taos_init_imp(void) { ...@@ -181,6 +181,8 @@ void taos_init_imp(void) {
tscTableMetaInfo = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); tscTableMetaInfo = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
tscDebug("TableMeta:%p", tscTableMetaInfo); tscDebug("TableMeta:%p", tscTableMetaInfo);
} }
int refreshTime = 5;
tscRpcCache = taosCacheInit(TSDB_DATA_TYPE_BINARY, refreshTime, true, tscFreeRpcObj, "rpcObj"); tscRpcCache = taosCacheInit(TSDB_DATA_TYPE_BINARY, refreshTime, true, tscFreeRpcObj, "rpcObj");
pthread_mutex_init(&rpcObjMutex, NULL); pthread_mutex_init(&rpcObjMutex, NULL);
...@@ -224,12 +226,11 @@ void taos_cleanup(void) { ...@@ -224,12 +226,11 @@ void taos_cleanup(void) {
taosCleanupKeywordsTable(); taosCleanupKeywordsTable();
taosCloseLog(); taosCloseLog();
m = tscRpcCache; p = tscRpcCache;
if (m != NULL && atomic_val_compare_exchange_ptr(&tscRpcCache, m, 0) == m) {
pthread_mutex_lock(&rpcObjMutex);
taosCacheCleanup(tscRpcCache);
tscRpcCache = NULL; tscRpcCache = NULL;
pthread_mutex_unlock(&rpcObjMutex);
if (p != NULL) {
taosCacheCleanup(p);
pthread_mutex_destroy(&rpcObjMutex); pthread_mutex_destroy(&rpcObjMutex);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册