commit
546d3b128e
|
@ -190,6 +190,7 @@ void dnodeFreeVnodeWqueue(void *wqueue) {
|
|||
|
||||
void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) {
|
||||
SWriteMsg *pWrite = (SWriteMsg *)param;
|
||||
if (pWrite == NULL) return;
|
||||
|
||||
if (code < 0) pWrite->code = code;
|
||||
int32_t count = atomic_add_fetch_32(&pWrite->processedCount, 1);
|
||||
|
|
|
@ -174,12 +174,15 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
|
|||
pThreadObj->stop = true;
|
||||
eventfd_t fd = -1;
|
||||
|
||||
// save thread into local variable since pThreadObj is freed when thread exits
|
||||
pthread_t thread = pThreadObj->thread;
|
||||
|
||||
if (taosComparePthread(pThreadObj->thread, pthread_self())) {
|
||||
pthread_detach(pthread_self());
|
||||
return;
|
||||
}
|
||||
|
||||
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) {
|
||||
if (taosCheckPthreadValid(pThreadObj->thread)) {
|
||||
// signal the thread to stop, try graceful method first,
|
||||
// and use pthread_cancel when failed
|
||||
struct epoll_event event = { .events = EPOLLIN };
|
||||
|
@ -196,8 +199,9 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
|
|||
}
|
||||
}
|
||||
|
||||
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) {
|
||||
pthread_join(pThreadObj->thread, NULL);
|
||||
// at this step, pThreadObj has already been released
|
||||
if (taosCheckPthreadValid(thread)) {
|
||||
pthread_join(thread, NULL);
|
||||
}
|
||||
|
||||
if (fd != -1) taosCloseSocket(fd);
|
||||
|
|
Loading…
Reference in New Issue