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

This commit is contained in:
yihaoDeng 2020-11-16 10:27:16 +00:00
parent a8b7c1e512
commit 08e6c5ecf6
2 changed files with 6 additions and 0 deletions

View File

@ -173,6 +173,9 @@ void *taosInitTcpServer(uint32_t ip, uint16_t port, char *label, int numOfThread
static void taosStopTcpThread(SThreadObj* pThreadObj) {
// save thread into local variable and signal thread to stop
pthread_t thread = pThreadObj->thread;
if (!taosCheckPthreadValid(thread)) {
return;
}
pThreadObj->stop = true;
if (taosComparePthread(thread, pthread_self())) {
pthread_detach(pthread_self());

View File

@ -302,6 +302,9 @@ static SThreadObj *taosGetTcpThread(SPoolObj *pPool) {
static void taosStopPoolThread(SThreadObj *pThread) {
pthread_t thread = pThread->thread;
if (!taosCheckPthreadValid(thread)) {
return;
}
pThread->stop = true;
if (taosComparePthread(thread, pthread_self())) {
pthread_detach(pthread_self());