[TD-1785]<fix>: taos_close may fail
This commit is contained in:
parent
db1ae55860
commit
a8b7c1e512
|
@ -173,11 +173,11 @@ 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;
|
||||||
|
pThreadObj->stop = true;
|
||||||
if (taosComparePthread(thread, pthread_self())) {
|
if (taosComparePthread(thread, pthread_self())) {
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pThreadObj->stop = true;
|
|
||||||
pthread_join(thread, NULL);
|
pthread_join(thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,10 +302,10 @@ 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;
|
||||||
|
pThread->stop = true;
|
||||||
if (taosComparePthread(thread, pthread_self())) {
|
if (taosComparePthread(thread, pthread_self())) {
|
||||||
pthread_detach(pthread_self());
|
pthread_detach(pthread_self());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pThread->stop = true;
|
|
||||||
pthread_join(thread, NULL);
|
pthread_join(thread, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue