From dbf80ec2a1117f662d2544262a91ca5ca4a0ceda Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Sun, 29 Nov 2020 02:09:08 +0000 Subject: [PATCH] move the callback out of lock --- src/util/src/tref.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/util/src/tref.c b/src/util/src/tref.c index dc9adb0858..f5b3dce2f0 100644 --- a/src/util/src/tref.c +++ b/src/util/src/tref.c @@ -429,11 +429,6 @@ static int taosDecRefCount(int rsetId, int64_t rid, int remove) { if (pNode->next) { pNode->next->prev = pNode->prev; } - - (*pSet->fp)(pNode->p); - - uTrace("rsetId:%d p:%p rid:%" PRId64 "is removed, hash:%d count:%d, free mem: %p", rsetId, pNode->p, rid, hash, pSet->count, pNode); - free(pNode); released = 1; } else { uTrace("rsetId:%d p:%p rid:%" PRId64 "is released, hash:%d count:%d", rsetId, pNode->p, rid, hash, pSet->count); @@ -446,7 +441,14 @@ static int taosDecRefCount(int rsetId, int64_t rid, int remove) { taosUnlockList(pSet->lockedBy+hash); - if (released) taosDecRsetCount(pSet); + if (released) { + (*pSet->fp)(pNode->p); + + uTrace("rsetId:%d p:%p rid:%" PRId64 "is removed, hash:%d count:%d, free mem: %p", rsetId, pNode->p, rid, hash, pSet->count, pNode); + free(pNode); + + taosDecRsetCount(pSet); + } return code; } -- GitLab