提交 0822e82d 编写于 作者: A Alex Duan

feat: support exit by kill heart-beat thread mode

上级 6a9bdb98
......@@ -225,6 +225,9 @@ DLL_EXPORT int taos_get_tables_vgId(TAOS *taos, const char *db, const char *tabl
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
DLL_EXPORT void taos_set_hb_quit(int8_t quitByKill);
/* --------------------------schemaless INTERFACE------------------------------- */
DLL_EXPORT TAOS_RES *taos_schemaless_insert(TAOS *taos, char *lines[], int numLines, int protocol, int precision);
......
......@@ -80,6 +80,7 @@ typedef struct {
int64_t appId;
// ctl
int8_t threadStop;
int8_t quitByKill;
TdThread thread;
TdThreadMutex lock; // used when app init and cleanup
SHashObj* appSummary;
......
......@@ -845,7 +845,12 @@ static void hbStopThread() {
return;
}
taosThreadJoin(clientHbMgr.thread, NULL);
// thread quit mode kill or inner exit from self-thread
if (clientHbMgr.quitByKill) {
taosThreadKill(clientHbMgr.thread, 0);
} else {
taosThreadJoin(clientHbMgr.thread, NULL);
}
tscDebug("hb thread stopped");
}
......@@ -1037,3 +1042,8 @@ void hbDeregisterConn(SAppHbMgr *pAppHbMgr, SClientHbKey connKey) {
atomic_sub_fetch_32(&pAppHbMgr->connKeyCnt, 1);
}
// set heart beat thread quit mode , if quicByKill 1 then kill thread else quit from inner
void taos_set_hb_quit(int8_t quitByKill) {
clientHbMgr.quitByKill = quitByKill;
}
......@@ -83,6 +83,9 @@ int main(int argc, char *argv[]) {
#endif
taos_init();
// kill heart-beat thread when quit
taos_set_hb_quit(1);
if (shell.args.is_dump_config) {
shellDumpConfig();
taos_cleanup();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册