提交 7e792f46 编写于 作者: 陶建辉(Jeff)'s avatar 陶建辉(Jeff)

dont use sleep

上级 aff890f3
...@@ -156,6 +156,7 @@ int main(int argc, char *argv[]) { ...@@ -156,6 +156,7 @@ int main(int argc, char *argv[]) {
} }
tInfo("client is initialized"); tInfo("client is initialized");
tInfo("threads:%d msgSize:%d requests:%d", appThreads, msgSize, numOfReqs);
gettimeofday(&systemTime, NULL); gettimeofday(&systemTime, NULL);
startTime = systemTime.tv_sec*1000000 + systemTime.tv_usec; startTime = systemTime.tv_sec*1000000 + systemTime.tv_usec;
......
...@@ -24,23 +24,21 @@ int msgSize = 128; ...@@ -24,23 +24,21 @@ int msgSize = 128;
int commit = 0; int commit = 0;
int dataFd = -1; int dataFd = -1;
void *qhandle = NULL; void *qhandle = NULL;
void *qset = NULL;
void processShellMsg() { void processShellMsg() {
static int num = 0; static int num = 0;
taos_qall qall; taos_qall qall;
SRpcMsg *pRpcMsg, rpcMsg; SRpcMsg *pRpcMsg, rpcMsg;
int type; int type;
void *pvnode;
qall = taosAllocateQall(); qall = taosAllocateQall();
while (1) { while (1) {
int numOfMsgs = taosReadAllQitems(qhandle, qall); int numOfMsgs = taosReadAllQitemsFromQset(qset, qall, &pvnode);
if (numOfMsgs <= 0) {
usleep(100);
continue;
}
tDebug("%d shell msgs are received", numOfMsgs); tDebug("%d shell msgs are received", numOfMsgs);
if (numOfMsgs <= 0) break;
for (int i=0; i<numOfMsgs; ++i) { for (int i=0; i<numOfMsgs; ++i) {
taosGetQitem(qall, &type, (void **)&pRpcMsg); taosGetQitem(qall, &type, (void **)&pRpcMsg);
...@@ -82,15 +80,6 @@ void processShellMsg() { ...@@ -82,15 +80,6 @@ void processShellMsg() {
} }
taosFreeQall(qall); taosFreeQall(qall);
/*
SRpcIpSet ipSet;
ipSet.numOfIps = 1;
ipSet.index = 0;
ipSet.port = 7000;
ipSet.ip[0] = inet_addr("192.168.0.2");
rpcSendRedirectRsp(ahandle, &ipSet);
*/
} }
...@@ -189,6 +178,8 @@ int main(int argc, char *argv[]) { ...@@ -189,6 +178,8 @@ int main(int argc, char *argv[]) {
} }
qhandle = taosOpenQueue(sizeof(SRpcMsg)); qhandle = taosOpenQueue(sizeof(SRpcMsg));
qset = taosOpenQset();
taosAddIntoQset(qset, qhandle, NULL);
processShellMsg(); processShellMsg();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册