Skip to content

Commit

Permalink
fix: pthread_create pass first args error
Browse files Browse the repository at this point in the history
  • Loading branch information
DuanKuanJun committed May 23, 2023
1 parent bbb17e6 commit bae299c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/benchQuery.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
// check invaid
if(nSqlCount == 0 || nConcurrent == 0 ) {
if(nSqlCount == 0)
errorPrint(" query sql count is %d. must set query sqls. \n", nSqlCount);
errorPrint(" query sql count is %ld. must set query sqls. \n", nSqlCount);
if(nConcurrent == 0)
errorPrint(" concurrent is %d , specified_table_query->concurrent must not zero. \n", nConcurrent);
return -1;
Expand All @@ -448,8 +448,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
// create threads
for (int j = 0; j < nConcurrent; j++) {
threadInfo *pThreadInfo = infos + j;
uint64_t seq = i * nConcurrent + j;
pThreadInfo->threadID = (int)seq;
pThreadInfo->threadID = i * nConcurrent + j;
pThreadInfo->querySeq = i;
if (iface == REST_IFACE) {
int sockfd = createSockFd();
Expand All @@ -470,7 +469,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
}
}

pthread_create(pids + seq, NULL, specifiedTableQuery, pThreadInfo);
pthread_create(pids + j, NULL, specifiedTableQuery, pThreadInfo);
}

// if failed, set termainte flag true like ctrl+c exit
Expand Down

0 comments on commit bae299c

Please sign in to comment.