Merge branch 'feature/scheduler' of github.com:taosdata/TDengine into feature/scheduler
This commit is contained in:
commit
e561496466
|
@ -154,20 +154,20 @@ static void destroyThrdObj(SCliThrdObj* pThrd);
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
|
||||
do { \
|
||||
int i = 0, sz = transQueueSize(&conn->cliMsgs); \
|
||||
for (; i < sz; i++) { \
|
||||
pMsg = transQueueGet(&conn->cliMsgs, i); \
|
||||
if (pMsg != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (i == sz) { \
|
||||
pMsg = NULL; \
|
||||
} else { \
|
||||
pMsg = transQueueRm(&conn->cliMsgs, i); \
|
||||
} \
|
||||
#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
|
||||
do { \
|
||||
int i = 0, sz = transQueueSize(&conn->cliMsgs); \
|
||||
for (; i < sz; i++) { \
|
||||
pMsg = transQueueGet(&conn->cliMsgs, i); \
|
||||
if (pMsg != NULL && pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
if (i == sz) { \
|
||||
pMsg = NULL; \
|
||||
} else { \
|
||||
pMsg = transQueueRm(&conn->cliMsgs, i); \
|
||||
} \
|
||||
} while (0)
|
||||
#define CONN_GET_NEXT_SENDMSG(conn) \
|
||||
do { \
|
||||
|
|
|
@ -644,6 +644,7 @@ static void uvDestroyConn(uv_handle_t* handle) {
|
|||
// free(conn);
|
||||
|
||||
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
|
||||
tTrace("work thread quit");
|
||||
uv_loop_close(thrd->loop);
|
||||
uv_stop(thrd->loop);
|
||||
}
|
||||
|
@ -705,12 +706,12 @@ End:
|
|||
return NULL;
|
||||
}
|
||||
void uvHandleQuit(SSrvMsg* msg, SWorkThrdObj* thrd) {
|
||||
thrd->quit = true;
|
||||
if (QUEUE_IS_EMPTY(&thrd->conn)) {
|
||||
uv_loop_close(thrd->loop);
|
||||
uv_stop(thrd->loop);
|
||||
} else {
|
||||
destroyAllConn(thrd);
|
||||
thrd->quit = true;
|
||||
}
|
||||
free(msg);
|
||||
}
|
||||
|
@ -773,15 +774,16 @@ void sendQuitToWorkThrd(SWorkThrdObj* pThrd) {
|
|||
void transCloseServer(void* arg) {
|
||||
// impl later
|
||||
SServerObj* srv = arg;
|
||||
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||
sendQuitToWorkThrd(srv->pThreadObj[i]);
|
||||
destroyWorkThrd(srv->pThreadObj[i]);
|
||||
}
|
||||
|
||||
tDebug("send quit msg to accept thread");
|
||||
uv_async_send(srv->pAcceptAsync);
|
||||
taosThreadJoin(srv->thread, NULL);
|
||||
|
||||
for (int i = 0; i < srv->numOfThreads; i++) {
|
||||
sendQuitToWorkThrd(srv->pThreadObj[i]);
|
||||
destroyWorkThrd(srv->pThreadObj[i]);
|
||||
}
|
||||
|
||||
free(srv->pThreadObj);
|
||||
free(srv->pAcceptAsync);
|
||||
free(srv->loop);
|
||||
|
|
Loading…
Reference in New Issue