This commit is contained in:
yihaoDeng 2021-01-31 00:05:33 +00:00
parent 93f4c2be96
commit d324102f85
1 changed files with 13 additions and 2 deletions

View File

@ -125,8 +125,6 @@ void cqFree(void *handle) {
pthread_mutex_unlock(&pContext->mutex); pthread_mutex_unlock(&pContext->mutex);
if (delete) { if (delete) {
pthread_mutex_unlock(&pContext->mutex);
pthread_mutex_destroy(&pContext->mutex); pthread_mutex_destroy(&pContext->mutex);
taosTmrCleanUp(pContext->tmrCtrl); taosTmrCleanUp(pContext->tmrCtrl);
@ -186,6 +184,18 @@ void *cqOpen(void *ahandle, const SCqCfg *pCfg) {
return pContext; return pContext;
} }
static void freeSCqContext(void *handle) {
if (handle == NULL) {
return;
}
SCqContext *pContext = handle;
pthread_mutex_destroy(&pContext->mutex);
taosTmrCleanUp(pContext->tmrCtrl);
pContext->tmrCtrl = NULL;
cDebug("vgId:%d, CQ is closed", pContext->vgId);
free(pContext);
}
void cqClose(void *handle) { void cqClose(void *handle) {
if (tsEnableStream == 0) { if (tsEnableStream == 0) {
return; return;
@ -217,6 +227,7 @@ void cqClose(void *handle) {
taosRemoveRef(cqObjRef, rid); taosRemoveRef(cqObjRef, rid);
} }
freeSCqContext(pContext);
} }
void cqStart(void *handle) { void cqStart(void *handle) {