提交 08e6c5ec 编写于 作者: dengyihao's avatar dengyihao

[TD-1786]<fix>: failure of taos_clos may cause core

上级 a8b7c1e5
...@@ -173,6 +173,9 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread ...@@ -173,6 +173,9 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread
static void taosStopTcpThread(SThreadObj* pThreadObj) { static void taosStopTcpThread(SThreadObj* pThreadObj) {
// save thread into local variable and signal thread to stop // save thread into local variable and signal thread to stop
pthread_t thread = pThreadObj->thread; pthread_t thread = pThreadObj->thread;
if (!taosCheckPthreadValid(thread)) {
return;
}
pThreadObj->stop = true; pThreadObj->stop = true;
if (taosComparePthread(thread, pthread_self())) { if (taosComparePthread(thread, pthread_self())) {
pthread_detach(pthread_self()); pthread_detach(pthread_self());
......
...@@ -302,6 +302,9 @@ static SThreadObj *taosGetTcpThread(SPoolObj *pPool) { ...@@ -302,6 +302,9 @@ static SThreadObj *taosGetTcpThread(SPoolObj *pPool) {
static void taosStopPoolThread(SThreadObj *pThread) { static void taosStopPoolThread(SThreadObj *pThread) {
pthread_t thread = pThread->thread; pthread_t thread = pThread->thread;
if (!taosCheckPthreadValid(thread)) {
return;
}
pThread->stop = true; pThread->stop = true;
if (taosComparePthread(thread, pthread_self())) { if (taosComparePthread(thread, pthread_self())) {
pthread_detach(pthread_self()); pthread_detach(pthread_self());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册