TD-1057
This commit is contained in:
parent
ed896f976b
commit
ef8135a609
|
@ -295,6 +295,7 @@ bool taosCfgDynamicOptions(char *msg) {
|
|||
}
|
||||
|
||||
static void doInitGlobalConfig(void) {
|
||||
osInit();
|
||||
SGlobalCfg cfg = {0};
|
||||
|
||||
// ip address
|
||||
|
|
|
@ -33,7 +33,11 @@ extern "C" {
|
|||
} \
|
||||
}
|
||||
typedef int SOCKET;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef TAOS_OS_DEF_EPOLL
|
||||
#define TAOS_EPOLL_WAIT_TIME -1
|
||||
#endif
|
||||
|
||||
#define taosClose(x) taosCloseSocket(x)
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ extern "C" {
|
|||
typedef SOCKET eventfd_t;
|
||||
#define eventfd(a, b) -1
|
||||
|
||||
#define TAOS_OS_DEF_EPOLL
|
||||
#define TAOS_EPOLL_WAIT_TIME 100
|
||||
|
||||
#define TAOS_OS_FUNC_STRING_WCHAR
|
||||
int twcslen(const wchar_t *wcs);
|
||||
#define TAOS_OS_FUNC_STRING_GETLINE
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "tglobal.h"
|
||||
#include "tulog.h"
|
||||
|
||||
extern void taosWinSocketInit();
|
||||
|
||||
void osInit() {
|
||||
strcpy(configDir, "C:/TDengine/cfg");
|
||||
strcpy(tsVnodeDir, "C:/TDengine/data");
|
||||
|
@ -27,4 +29,5 @@ void osInit() {
|
|||
strcpy(tsLogDir, "C:/TDengine/log");
|
||||
strcpy(tsScriptDir, "C:/TDengine/script");
|
||||
strcpy(tsOsName, "Windows");
|
||||
taosWinSocketInit();
|
||||
}
|
|
@ -38,6 +38,7 @@ static void httpStopThread(HttpThread* pThread) {
|
|||
eventfd_t fd = eventfd(1, 0);
|
||||
if (fd == -1) {
|
||||
httpError("%s, failed to create eventfd, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno));
|
||||
pThread->stop = true;
|
||||
pthread_cancel(pThread->thread);
|
||||
} else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
|
||||
httpError("%s, failed to call epoll_ctl, will call pthread_cancel instead, which may result in data corruption: %s", pThread->label, strerror(errno));
|
||||
|
|
|
@ -174,6 +174,7 @@ static void taosStopTcpThread(SThreadObj* pThreadObj) {
|
|||
if (fd == -1) {
|
||||
// failed to create eventfd, call pthread_cancel instead, which may result in data corruption:
|
||||
tError("%s, failed to create eventfd(%s)", pThreadObj->label, strerror(errno));
|
||||
pThreadObj->stop = true;
|
||||
pthread_cancel(pThreadObj->thread);
|
||||
} else if (epoll_ctl(pThreadObj->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
|
||||
// failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption:
|
||||
|
@ -464,7 +465,7 @@ static void *taosProcessTcpData(void *param) {
|
|||
SRecvInfo recvInfo;
|
||||
|
||||
while (1) {
|
||||
int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, -1);
|
||||
int fdNum = epoll_wait(pThreadObj->pollFd, events, maxEvents, TAOS_EPOLL_WAIT_TIME);
|
||||
if (pThreadObj->stop) {
|
||||
tDebug("%s TCP thread get stop event, exiting...", pThreadObj->label);
|
||||
break;
|
||||
|
|
|
@ -184,7 +184,7 @@ static void *taosProcessTcpData(void *param) {
|
|||
|
||||
while (1) {
|
||||
if (pThread->stop) break;
|
||||
int fdNum = epoll_wait(pThread->pollFd, events, maxEvents, -1);
|
||||
int fdNum = epoll_wait(pThread->pollFd, events, maxEvents, TAOS_EPOLL_WAIT_TIME);
|
||||
if (pThread->stop) {
|
||||
uDebug("%p TCP epoll thread is exiting...", pThread);
|
||||
break;
|
||||
|
@ -313,6 +313,7 @@ static void taosStopPoolThread(SThreadObj* pThread) {
|
|||
// failed to create eventfd, call pthread_cancel instead, which may result in data corruption
|
||||
uError("failed to create eventfd(%s)", strerror(errno));
|
||||
pthread_cancel(pThread->thread);
|
||||
pThread->stop = true;
|
||||
} else if (epoll_ctl(pThread->pollFd, EPOLL_CTL_ADD, fd, &event) < 0) {
|
||||
// failed to call epoll_ctl, call pthread_cancel instead, which may result in data corruption
|
||||
uError("failed to call epoll_ctl(%s)", strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue