Skip to content

Commit

Permalink
Merge pull request #657 from taosdata/fix/TD-24314
Browse files Browse the repository at this point in the history
fix: cancel and no wait thread exit
  • Loading branch information
plum-lihui committed May 22, 2023
2 parents aa67feb + 411604c commit 3063c09
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ static int startMultiThreadCreateChildTable(
pthread_create(pids + i, NULL, createTable, pThreadInfo);
}

for (int i = 0; (i < threads && !g_arguments->terminate); i++) {
for (int i = 0; (i < threads && pids[i] !=0); i++) {
pthread_join(pids[i], NULL);
}

Expand Down Expand Up @@ -3179,8 +3179,13 @@ static int startMultiThreadInsertData(SDataBase* database,
int64_t start = toolsGetTimestampUs();

// wait threads
for (int i = 0; (i < threads && !g_arguments->terminate); i++) {
pthread_join(pids[i], NULL);
for (int i = 0; (i < threads); i++) {
if(pids[i] != 0) {
infoPrint(" pthread_join %d ...\n", i);
pthread_join(pids[i], NULL);
} else {
infoPrint(" pthread_join %d is null , not wait.\n", i);
}
}

int64_t end = toolsGetTimestampUs()+1;
Expand Down

0 comments on commit 3063c09

Please sign in to comment.