提交 4bb83933 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

remove the pollFd check

上级 0057a138
...@@ -174,16 +174,15 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) { ...@@ -174,16 +174,15 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
pThreadObj->stop = true; pThreadObj->stop = true;
eventfd_t fd = -1; eventfd_t fd = -1;
// save thread and pollFd into local variable since pThreadObj will be freed when thread exits // save thread into local variable since pThreadObj is freed when thread exits
pthread_t thread = pThreadObj->thread; pthread_t thread = pThreadObj->thread;
SOCKET pollFd = pThreadObj->pollFd;
if (taosComparePthread(pThreadObj->thread, pthread_self())) { if (taosComparePthread(pThreadObj->thread, pthread_self())) {
pthread_detach(pthread_self()); pthread_detach(pthread_self());
return; return;
} }
if (taosCheckPthreadValid(pThreadObj->thread) && pThreadObj->pollFd >= 0) { if (taosCheckPthreadValid(pThreadObj->thread)) {
// signal the thread to stop, try graceful method first, // signal the thread to stop, try graceful method first,
// and use pthread_cancel when failed // and use pthread_cancel when failed
struct epoll_event event = { .events = EPOLLIN }; struct epoll_event event = { .events = EPOLLIN };
...@@ -200,8 +199,8 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) { ...@@ -200,8 +199,8 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
} }
} }
// at this step, pThreadObj may have been released // at this step, pThreadObj has already been released
if (taosCheckPthreadValid(thread) && pollFd >= 0) { if (taosCheckPthreadValid(thread)) {
pthread_join(thread, NULL); pthread_join(thread, NULL);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册